Hacker News new | ask | show | jobs
by cjfd 350 days ago
This talks about 'bad' seeding quite a lot. But it really depends on what you need what is bad and what is good. Sometimes you need to have a reproducible program so you need to write the random number generator yourself and/or otherwise fix the algorithm. Then you can use '5' as the seed. This is quite often good enough for simulations. Sometimes you want to create cryptographic randomness. Then you need to somewhere find some seed of true randomness that is not guessable. In a computer game where the level needs some random elements just seeding the random number generator with the current time might be fine. And so on.
1 comments

I don't think it disputes that sometimes using a fixed small number is a good seed for reproducibility. The point is just, if you do happen to be in the other camp, where you actually want to populate the full state of the RNG using hardware randomness, C++ does not give you an obvious way to do that.