Jerzy Karczmarczuk wrote:
> > > class RandomGen g where
> > > next :: g -> (Int, g)
> > > split :: g -> (g, g)
> > > genRange :: g -> (Int, Int)
> > > genRange _ = (minBound, maxBound)
>
> Do you always use integer random numbers?
No. But this is the primitive class we're discussing here. The library
also defines
class Random a where
randomR :: RandomGen g => (a, a) -> g -> (a, g)
random :: RandomGen g => g -> (a, g)
randomRs :: RandomGen g => (a, a) -> g -> [a]
randoms :: RandomGen g => g -> [a]
randomRIO :: (a,a) -> IO a
randomIO :: IO a
with
instance Random Float
instance Random Double
Where no range is specified the float or double should be in the range
[0,1). It should of course be uniformly distributed.
It is reasonable IMHO that the primitive random generator should
generate integers rather than floats, as I think most pseudo-random
generation methods generate integers of some sort.