
I definitely agree that the StdGen fields should be unpacked.
The slightly stricter evaluation of the randomRs generator seems like the
right solution as well.
-Edward
On Thu, Jul 18, 2013 at 4:16 PM, Bas van Dijk
On 17 July 2013 19:00, Hans Georg Schaathun
wrote: Hi all,
I have been digging into the System.Random module lately. Initially, I was concerned about the split method, but trying to understand the code and algorithm, there are a couple of other issues that bother me. I hope this is the right forum to ask about them ...
Hi Hans, no comments on your issues yet. I just wanted to report an issue in random I discovered 3 months ago. This is the message I send to Ryan:
My colleague (Utkarsh Upadhyay) got a stack-overflow in a program he was working on. Thomas Schilling and me traced it down to randomRs being to lazy which causes the following to generate a stack-overflow exception:
g <- getStdGen randomRs (0,10::Int) g !! 1000000
The attached patch fixes the bug. I also included a patch to UNPACK the Int32 fields into the StdGen constructor.
I added the patches to the following gist:
https://gist.github.com/basvandijk/6032630
Cheers,
Bas
_______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries