Random Generator

Koen Claessen [email protected]
Wed, 8 Aug 2001 20:41:27 +0200 (MET DST)

Hannah Schroeter wrote:

 | * thread a random generator through randomPick, giving it the
 |   type signature:
 |   randomPick :: (RandomGen g) => g -> Int -> [a] -> ([a], g)

It is not necessary to thread the random generator through.
This is the reason why the "split" function exists in the
Random library.

Instead of a "stateful" (and strict) computation, one can
distribute different random seeds over one's (lazy)

So, randomPick only has to have the following type:

  randomPick :: StdGen -> Int -> [a] -> [a]

Invoking it on the same generator will give the same