[Haskell-cafe] Performance problem with random numbers

ntupel ntupel at googlemail.com
Wed Oct 17 03:14:42 EDT 2007

On Sat, 2007-10-13 at 18:33 -0300, Isaac Dupree wrote:
> GHC StdGen's random and randomR are somewhat slow.  I found that 
> changing to a custom ((x*a + b) `mod` c) random-generator (instance of 
> RandomGen) much sped things up (since nothing depended on the random 
> numbers being good quality).

Yes, I also switched now to a simple custom linear congruential
generator (which is random enough for this task) and restructured the
code a bit and am happy now since it is even a bit faster than the Java
implementation :)


More information about the Haskell-Cafe mailing list