hat-2.9.0.0: The Haskell tracer, generating and viewing Haskell execution traces

Safe HaskellNone
LanguageHaskell98

Hat.Random

Synopsis

Documentation

class RandomGen g where Source

Minimal complete definition

sgenRange, gnext, gsplit

Instances

data StdGen :: *

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.

class Random a where Source

Minimal complete definition

grandomR, grandom, srandomRs, srandoms, srandomRIO

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

grandomIO :: RefSrcPos -> RefExp -> R (IO a) Source

srandomIO :: R (IO a) Source