I would like to clarify my understanding of how the System.Random of Haskell works after reading the I/O chapter of Learn You a Haskell For A Great Good.
From what I understand, a value of type StdGen behaves like the generating seed of a random-sequence. That would mean the StdGen type is nothing but a kind of tagged (but random) integer, with the tag being StdGen. Is this correct?
Also getStdGen queries the operating system (or something else possibly?) for a starting seed and the result of executing that action gets stored in gen.
Whenever I try to print a value of type StdGen I see two largish integers always separated by a white-space, as you can see below. I would have imagined that this value would have been a single integer. So what does that white-space stand for?
Prelude System.Random> gen <- getStdGen
Prelude System.Random>
Prelude System.Random> gen
751404879 1655838864
Prelude System.Random>
Aucun commentaire:
Enregistrer un commentaire