Need help
Junjie Xu
ceejx@cee.hw.ac.uk
Tue, 23 Jul 2002 14:36:48 +0100 (BST)
Hi there,
I found I can't generate a random float number(between 0 to 1) use the
following method.
*****************************************************************
module Main where
import System(getArgs)
import Random
uni :: Float
uni = head (randoms g)
where
g = mkStdGen 77
main = print (show (uni))
**********************************************
once I run it, it will generate a float number. When I run it again, it
genetrate the same result. I think maybe the cause is that the seed is
77.
To solve this, I think the seed should be replaced by current time .But I
don't know how to capture the time.
I referenced the relevant library, but I still have no idea.
Who know the solution, please give me a hand.
Thank you very much.
Kevin Xu