On Wed, Oct 7, 2009 at 2:28 PM, Michael Mossey <m...@alumni.caltech.edu>wrote:

> I don't quite follow your response. I want a program that initializes the
> generator from the global generator because I want different behavior every
> time I run it. So it will need IO. That's what I was trying to demonstrate.
> And I was wondering if one can get around the difficulty of passing the
> generator from call to call by using newStdGen in this way.
>

You should only have to call newStdGen once:

main = do
   g <- newStdGen
   let (g1,g2) = split g
   let xs = [1..10]
   print $ shuffle g1 xs
   print $ shuffle g2 xs
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to