newbie:: getting random Ints
Ketil Z. Malde
02 Apr 2002 11:03:29 +0200
Peter Rooney <email@example.com> writes:
> I can't seem to generate random numbers.
Depending on why you need random numbers, you might want to consider
using a fixed seed, i.e.
a = randoms (mkStdGen 4711)
will get you a sequence of "random" numbers. Of course, it will be
the same sequence for every run of your program, but in some cases,
(when you only want arbitrary data, and not necessarily random) this
won't matter much.
The advantage is, of course, that you get rid of the IO monad. I've
toyed with the idea of using unsafePerformIO (at least to get the
seed), but haven't quite dared (or needed) to yet. :-)
If I haven't seen further, it is by standing in the footprints of giants