Either I am misunderstanding something or there is an infelicityin the implementation of StdGen. The documentation on mkStdGen saysthat distinct arguments should be likely to produce distinct generators.This made me think that I would get a reasonable pseudo-random functionto simulate n rolls of a die by using n to seed the random number generator:import System.Randomroll :: Int -> Stringroll n = take n . randomRs ('1', '6') . mkStdGen $ nHowever, this produces a string beginning with a '6' for 0 <= n <= 53667.In fact the dependency of the first value on the seed seems to be far fromrandom:map (\l -> (head l, length l)) . group . map (fst . randomR (1, 6) . mkStdGen) $ [0..25*53668+6]returns:[(6,53668),(5,53668),(4,53668),(3,53669),(2,53668),(1,53668),(6,53669),(5,53668),(4,53668),(3,53669),(2,53668),(1,53668),(6,53668),(5,53669),(4,53668),(3,53668),(2,53669),(1,53668),(6,53668),(5,53669),(4,53668),(3,53668),(2,53669),(1,53668),(6,53668)]The behaviour seems to be related to the length of the range.You get similar behaviour for ranges of length 2, 3, 6 and 9 for example,but not for 4, 5, 7 or 8.If it is relevant, I am using ghc version 7.6.3.Regards,Rob.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe