In erlang, first i use the following function to set the seed: new_seed() -> {_,_,X} = erlang:now(), {H,M,S} = time(), H1 = H * X rem 32767, M1 = M * X rem 32767, S1 = S * X rem 32767, put(random_seed, {H1,M1,S1}).
then use random:uniform/1 to get the random number. In haskell, i just use the following function to get the random number. It seems i donot need to set the seed of random number generator manually? rollDice :: Int -> IO Int rollDice n = randomRIO(1,n) Sincerely! ----- fac n = foldr (*) 1 [1..n] -- View this message in context: http://old.nabble.com/How-can-i-set-the-seed-random-number-generator---tp26882798p26882798.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe