repa-algorithms-3.4.1.2: Algorithms using the Repa array library.

Safe HaskellNone
LanguageHaskell98

Data.Array.Repa.Algorithms.Randomish

Synopsis

Documentation

randomishIntArray #

Arguments

:: Shape sh 
=> sh

Shape of array

-> Int

Minumum value in output.

-> Int

Maximum value in output.

-> Int

Random seed.

-> Array U sh Int

Array of randomish numbers.

Use the ''minimal standard'' Lehmer generator to quickly generate some random numbers with reasonable statistical properties. By 'reasonable' we mean good enough for games and test data, but not cryptography or anything where the quality of the randomness really matters.

By nature of the algorithm, the maximum value in the output is clipped to (valMin + 2^31 - 1)

From ''Random Number Generators: Good ones are hard to find'' Stephen K. Park and Keith W. Miller. Communications of the ACM, Oct 1988, Volume 31, Number 10.

randomishIntVector #

Arguments

:: Int

Length of vector.

-> Int

Minumum value in output.

-> Int

Maximum value in output.

-> Int

Random seed.

-> Vector Int

Vector of randomish numbers.

randomishDoubleArray #

Arguments

:: Shape sh 
=> sh

Shape of array

-> Double

Minumum value in output.

-> Double

Maximum value in output.

-> Int

Random seed.

-> Array U sh Double

Array of randomish numbers.

Generate some randomish doubles with terrible statistical properties. This just takes randomish ints then scales them, so there's not much randomness in low-order bits.

randomishDoubleVector #

Arguments

:: Int

Length of vector

-> Double

Minimum value in output

-> Double

Maximum value in output

-> Int

Random seed.

-> Vector Double

Vector of randomish doubles.

Generate some randomish doubles with terrible statistical properties. This just takes randmish ints then scales them, so there's not much randomness in low-order bits.