| Safe Haskell | None |
|---|---|
| Language | Haskell98 |
Hat.Random
Contents
- class RandomGen g where
- data StdGen :: *
- gmkStdGen :: RefSrcPos -> RefExp -> R (Fun Int StdGen)
- amkStdGen :: RefAtom
- hmkStdGen :: R Int -> RefExp -> R StdGen
- class Random a where
- ggetStdRandom :: RefSrcPos -> RefExp -> R (Fun (Fun StdGen (Tuple2 a StdGen)) (IO a))
- agetStdRandom :: RefAtom
- hgetStdRandom :: R (Fun StdGen (Tuple2 b StdGen)) -> RefExp -> R (IO b)
- ggetStdGen :: RefSrcPos -> RefExp -> R (IO StdGen)
- gsetStdGen :: RefSrcPos -> RefExp -> R (Fun StdGen (IO Tuple0))
- asetStdGen :: RefAtom
- hsetStdGen :: R StdGen -> RefExp -> R (IO Tuple0)
- gnewStdGen :: RefSrcPos -> RefExp -> R (IO StdGen)
Documentation
The StdGen instance of RandomGen has a genRange of at least 30 bits.
The result of repeatedly using next should be at least as statistically
robust as the Minimal Standard Random Number Generator described by
[System.Random, System.Random].
Until more is known about implementations of split, all we require is
that split deliver generators that are (a) not identical and
(b) independently robust in the sense just given.
The Show and Read instances of StdGen provide a primitive way to save the
state of a random number generator.
It is required that .read (show g) == g
In addition, reads may be used to map an arbitrary string (not necessarily one
produced by show) onto a value of type StdGen. In general, the Read
instance of StdGen has the following properties:
- It guarantees to succeed on any string.
- It guarantees to consume only a finite portion of the string.
- Different argument strings are likely to result in different results.
Minimal complete definition
Methods
grandomR :: RandomGen g => RefSrcPos -> RefExp -> R (Fun (Tuple2 a a) (Fun g (Tuple2 a g))) Source #
srandomR :: RandomGen g => R (Fun (Tuple2 a a) (Fun g (Tuple2 a g))) Source #
grandom :: RandomGen g => RefSrcPos -> RefExp -> R (Fun g (Tuple2 a g)) Source #
srandom :: RandomGen g => R (Fun g (Tuple2 a g)) Source #
grandomRs :: RandomGen g => RefSrcPos -> RefExp -> R (Fun (Tuple2 a a) (Fun g (List a))) Source #
srandomRs :: RandomGen g => R (Fun (Tuple2 a a) (Fun g (List a))) Source #
grandoms :: RandomGen g => RefSrcPos -> RefExp -> R (Fun g (List a)) Source #
srandoms :: RandomGen g => R (Fun g (List a)) Source #
grandomRIO :: RefSrcPos -> RefExp -> R (Fun (Tuple2 a a) (IO a)) Source #
srandomRIO :: R (Fun (Tuple2 a a) (IO a)) Source #
asetStdGen :: RefAtom Source #