[Haskell-cafe] random question

Nicolas Pouillard nicolas.pouillard at gmail.com
Thu Oct 8 05:32:55 EDT 2009


Excerpts from Bryan O'Sullivan's message of Wed Oct 07 23:25:10 +0200 2009:
> On Wed, Oct 7, 2009 at 1:59 PM, Michael Mossey <mpm at alumni.caltech.edu>wrote:
> 
> > My thread about randomness got hijacked so I need to restate my remaining
> > question here. Is it acceptable to write pure routines that use but do not
> > return generators, and then call several of them from an IO monad with a
> > generator obtained by several calls to newStdGen?
> >
> > shuffle :: RandomGen g => g -> [a] -> [a]
> > shuffle = ...
> >
> > foo :: [a] -> [a] -> IO ()
> > foo xs ys = do
> >  g1 <- newStdGen
> >  print $ shuffle g1 xs
> >  g2 <- newStdGen
> >  print $ shuffle g2 ys
> >
> > Does this kind of thing exhibit good pseudorandomness?
> >
> 
> If you believe in the safety of the split operation (which I don't), then
                                                      ^^^^^^^^^^^^^^^^
                                                             |
Can you elaborate on that?  ---------------------------------+

Best regards,

-- 
Nicolas Pouillard
http://nicolaspouillard.fr


More information about the Haskell-Cafe mailing list