Search code examples
haskellprng

What is a good value to seed a stdgen


I need to find a good value to feed into mkStdGen as a seed.

The first thing I'd normally do is just use the ticks since the beginning of the epoch, however, to do that I use getClockTime from System.Time, which according to hackage is deprecated, in favour of Data.Time. The latter doesn't seem to expose this functionality though.

Is there a better way to generate a seed for this value? Or should I just ignore the deprecation warning?


Solution

  • This is usually unnecessary, because the global StdGen is seeded with the current time at startup. So you can just use randomIO and randomRIO and have an implicit, IO-based random number generator, or getStdGen and the usual pure functions for a more explicit one.