Your message dated Mon, 1 Mar 2010 14:28:46 -0600
with message-id <20100301202846.ga31...@progeny.tock>
has caused the report #63843,
regarding mawk: random numbers are not always the same (as in C)
to be marked as having been forwarded to the upstream software
author(s)
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)
--
63843: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=63843
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
tags 63843 + upstream
tags 63843 - patch
severity 63843 normal
thanks
Santiago Vila wrote:
> Today I was surprised to discover that mawk's rand() function
> does not always generate the same random numbers on every run.
>
> mawk(1) explains why: "mawk seeds the random number generator from
> the clock at startup so there is no real need to call srand().
> Srand(expr) is useful for repeating pseudo random sequences."
>
> However, this behaviour is counter-intuitive from the point of view
> of a C programmer, and in fact the other two awk implementations
> in Debian do not need an explicit srand() for the random numbers to be
> the same on every run.
Yes, this violates POSIX (though I wish it didn’t, since it’s usually
the most convenient behavior). In fact, the default random sequence
is required to be the same as that produced after srand(1).
The patch at http://bugs.debian.org/63843 is of course unsuitable, but
maybe something similar would work.
Cheers,
Jonathan
--- End Message ---