Fill a vector with randoms.
Return a random vector of length
n, filled with random elements
a generated by the mersenne-twister.
E.g. to compute the sum of 100 million random Double values in a vector:
import qualified Data.VectorUnboxed as U import System.Random.Mersenne.Pure64 import qualified Data.Vector.Random.Mersenne as G main = do g <- newPureMT let a = G.random g 10000000 :: U.Vector Double print (U.sum a)
The generator will fuse under stream fusion, so e.g. sum . random g will allocate no intermediate array.
Class of MT random types
Class of types that we have efficient generators for.
Given a pure mersenne twister state, yield a new random value, and the next state.