I’m working on a card game and I need the shuffle algorithm to do a very good job and to be different every time the game runs and to not have predictable card sequences.
I’m using the Mersenne twister algorithm but it still needs a seed, so really, although it produces great numbers, right now there are only 1000 possible sequences of games since I’m using time(NULL) to seed. How should I be seeding?
My standard seeding technique:
If
/dev/urandomexists, read a seed from there.If you’re in Windows, use
CryptGenRandom().If all else fails, use
time().(Not sure where your Mersenne twister comes from, but there new standard library has one in
<random>which integrates very elegantly.)I’m happy to hear suggestions for platforms that aren’t covered by the first two steps!