- randoms :: (PureMTRandom a, Vector v a) => PureMT -> Int -> v a
- class PureMTRandom a where

# Fill a vector with randoms.

randoms :: (PureMTRandom a, Vector v a) => PureMT -> Int -> v aSource

Return a random vector of length `n`

, filled with random elements
of type `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.