[Haskell-cafe] Performance problem with random numbers

ntupel ntupel at googlemail.com
Sat Oct 13 11:40:34 EDT 2007


On Sat, 2007-10-13 at 09:56 -0400, Brandon S. Allbery KF8NH wrote:
> Now you need to start forcing things; given laziness, things tend to  
> only get forced when in IO, which leads to time being accounted to  
> the routine where the forcing happened.  If random / randomR are  
> invoked with large unevaluated thunks, their forcing will generally  
> be attributed to them, not to functions within the thunks.

But AFAIK random and randomR only take a StdGen (plus a range argument
in case of randomR) as argument so I don't understand where the
unevaluated thunks might be actually? (Maybe I should have said that
random and randomR are the ones from GHC's System.Random module.)

Thanks,
Thoralf




More information about the Haskell-Cafe mailing list