Hi! I am trying to save and restore a random number generator using the new System.Random
(random 1.2) interface. I am failing completely, because I do not understand the types of freezeGen
and thawGen
(but maybe I do not even need those).
Ideally I want something like:
f :: IO ()
f = do
g <- newIOGenM $ mkStdGen 42
doALotOfFunStuffWithG g
s <- saveGenerator g
print s
This should print the current seed (or seed tuple, as far as I can tell form looking at splitmix), and newIOGenM $ mkStdGen s
should be the same g
(when it was saved).
Thanks for your help.