hsnoise-0.0.3: A coherent 3d noise library.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Numeric.Noise.Random

Description

A simple implementation of a pure linear congruential psuedo-random number generator.

Example of use:

main = do
    let seed = 1
    let (r, seed') = randomInt seed
    putStrLn ("Random number 1: " ++ show r)
    let (r', seed'') = randomInt seed'
    putStrLn ("Random number 2: " ++ show r')
    putStrLn ("Random int list: " ++ show (randomInts 10 seed))
    putStrLn ("Shuffled list: " ++ show (shuffle [1..10] seed))
 
Synopsis

Documentation

randomInt :: Seed -> (Int, Seed) Source #

Returns a random Int and the next seed given a seed.

randomInts :: Seed -> Int -> [Int] Source #

Returns a random sequence of Ints given a seed and the number of Ints to generate.

shuffle :: [a] -> Seed -> [a] Source #

Returns a shuffled list containing the same elements as the given list given a seed.