4 ms·
> In essence just creating a new random number generator in go w/o setting the seed will not actually generate random values. This change only affects the glob
by chimeracoder 4y ago
> In essence just creating a new random number generator in go w/o setting the seed will not actually generate random values.
This change only affects the global RNG. Creating a new RNG has always required setting a seed
- akira2501 4y agoWhich is also significant because the global RNG is safe for concurrent use. Instantiated RNGs are not.
- chimeracoder 4y ago> Which is also significant because the global RNG is safe for concurrent use. Instantiated RNGs are not. Amusingly, I submitted a patch for this some years ago, and it was rejected on the grounds that callers might depend on the specific sequence of numbers outputted by the global RNG using the default seed, which could break the compatibility promise. Now that that's been deemed a non-issue, I might resubmit.
- e12e 4y agoTo be clear, if setting a global seed was required it would not be so bad - but silently seeding with 1 is an edge that's pretty easy to trip on.