Your message dated Mon, 1 Mar 2010 14:28:46 -0600
with message-id <[email protected]>
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
(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 [email protected]
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Re: mawk: random numbers are not always the same as in C
Mon, 1 Mar 2010 14:28:46 -0600
tags 63843 + upstream
tags 63843 - patch
severity 63843 normal
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.
--- End Message ---