EDIT: Okay, C and a bunch of other languages I don't use. Keep the roasts coming, guys. :D
EDIT: Okay, C and a bunch of other languages I don't use. Keep the roasts coming, guys. :D
POSIX (or at least ISO C) defines rand as being seeded with 0 by default.
Stay safe everyone.
But of course, rather than make people study up, let's just dumb shit down
(BTW, I'm deliberately avoiding making any distinction between so-called "true random" and PRNG above, because the difference isn't actually meaningful here!)
Not a Go programmer though but that was my understanding.
Personally I've wrote a whole bunch of unit tests in the past that relies on that repeatability property "math/rand" has over "crypt/rand"
I don't really see an issue with either default, so long as it's documented and you can use a fixed seed if you'd like. I personally like needing to set a random seed explicitly. But then again, I learned about using random number generators a long time ago when this was always required, so what I think is obvious is probably a surprise to many (as shown by this stdlib change).
The only downside about this new change was that in the old way, if you needed a cryptographically secure random number, you had to explicitly call those functions from the stdlib. The choice should have been deliberate, but people don't like to read documentation...