[Haskell-cafe] Hangman game
gale at sefer.org
Mon Jan 21 18:41:45 EST 2008
>> Generating an infinite list from a random generator "burns up"
>> the generator, making it unusable for any further calculations.
Jake McArthur wrote:
> That's what the split function is for. ^_^
Yes, that is a nice approach. I have been avoiding it due to
the following comment in the docs for System.Random:
"This is very useful in functional programs... but very little
work has been done on statistically robust implementations
of split ([System.Random#Burton, System.Random#Hellekalek]
are the only examples we know of)."
And my own experience has been that cases where I need split
tend to be in a state monad anyway, where there isn't any
real advantage to split.
That said, looking around briefly, I came up with this paper
by L'Ecuyer et al that does seem to describe a decent
random generator with properties of split worked out:
L'Ecuyer's implementations in C, C++ and Java are here:
If we had something like that in Haskell, I might use
split more often.
More information about the Haskell-Cafe