type classes and generality

Alexander V. Voinov avv@quasar.ipa.nw.ru
Mon, 09 Jul 2001 18:10:50 -0700


Hi All,

Fergus Henderson wrote:
> Ah, now I think I understand your problem.  You want to `random' to
> generate random numbers that span all the possible values of the type
> within the range [0, 1], or at least a substantial subset, but the "Real"
> class doesn't let you generate any numbers other than integers.
> The above approach will give you random numbers from `random', but they
> will only ever be 0 or 1, so maybe they are not as random as you needed! ;-)

Each pseudorandom generator generates a countable sequence of values,
which is isomorphic to a sequence of integers. In good old (Turbo)C we
got something between 0 and MAXINT and then divided by (double)MAXINT.
Can't _this_ be done in Haskell?

Alexander