-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Generate vectors filled with high quality pseudorandom numbers -- -- Generate vectors filled with high quality pseudorandom numbers @package vector-random @version 0.2 module Data.Vector.Random.Mersenne -- | 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. randoms :: (PureMTRandom a, Vector v a) => PureMT -> Int -> v a -- | Class of types that we have efficient generators for. class PureMTRandom a random :: PureMTRandom a => PureMT -> (a, PureMT) instance PureMTRandom Integer instance PureMTRandom Bool instance PureMTRandom Int64 instance PureMTRandom Int32 instance PureMTRandom Int16 instance PureMTRandom Int8 instance PureMTRandom Int instance PureMTRandom Word64 instance PureMTRandom Word32 instance PureMTRandom Word16 instance PureMTRandom Word8 instance PureMTRandom Word instance PureMTRandom Float instance PureMTRandom Double