Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Having the seed value set to the same value at run time will cause the pseudorandom number generator to produce the same sequence of values. In essence just creating a new random number generator in go w/o setting the seed will not actually generate random values.


> 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


To 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.


Which is also significant because the global RNG is safe for concurrent use. Instantiated RNGs are not.


> 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: