help-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Change seed for every iteration


From: J Naman
Subject: Re: Change seed for every iteration
Date: Fri, 3 Nov 2023 17:12:41 -0400

Gosh, I (re)opened a can of time worms. One the one hand, it is easy to
change the 10^8 to a value appropriate to the highest-resolution time stamp
of a particular system. On many systems, that may be microsecs = 10^6,
which is almost 20 bits or down to 4 or 5 bits on older systems.
Here is a problem to consider. Using 20 bit seeds for integer random
numbers means the seeds are constrained to 1/4096 = 0.02% of an integer
seed set. rand() will perform hugely better if only one seed is used vs
reseeding super frequently. I personally seed once at program start and let
rand() do its job.

Alternatively, one can get seeds from https://www.random.org/ , which
offers true random numbers to anyone on the Internet. The randomness comes
from atmospheric noise, which for many purposes is better than the
pseudo-random number algorithms typically used in computer programs. (or
timestamps)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]