randjump

randjump(r::MersenneTwister, jumps, [jumppoly]) -> Vector{MersenneTwister}

Create an array of the size jumps of initialized MersenneTwister RNG objects where the first RNG object given as a parameter and following MersenneTwister RNGs in the array initialized such that a state of the RNG object in the array would be moved forward (without generating numbers) from a previous RNG object array element on a particular number of steps encoded by the jump polynomial jumppoly.

Default jump polynomial moves forward MersenneTwister RNG state by 10^20 steps.

Examples

julia> rng = MersenneTwister(1234);

julia> jumps = 3;

julia> randjump(rng, jumps)
3-element Array{MersenneTwister,1}:
 MersenneTwister(UInt32[0x000004d2], Random.DSFMT.DSFMT_state(Int32[-2115385294, 1073037238, 73862611, 1073047902, -1584818444, 1072790965, -1002803354, 1073073531, 1867174705, 1072989784  …  -802702209, 1073036324, 170411090, 1073436159, -1584764...
 MersenneTwister(UInt32[0x9d5491ab], Random.DSFMT.DSFMT_state(Int32[-441090755, 1072971273, -1209979659, 1073138285, 1500820007, 1072862350, -1324557818, 1073084498, -150440616, 1072976371  …  -471713075, 1073093888, -730460844, 1073378142, -207791...
 MersenneTwister(UInt32[0x6fdcd4c], Random.DSFMT.DSFMT_state(Int32[2047000078, 1072886974, -883898001, 1073162137, 1672368019, 1072822169, -1264565155, 1073030781, -1575901173, 1073056917  …  547014271, 1072790891, -1961232728, 1073084430, 100881556...

This example demonstrates the usage of the randjump function. It creates an array of MersenneTwister RNG objects of size jumps (which is 3 in this case). The first RNG object is provided as the parameter rng, and subsequent RNG objects in the array are initialized to be moved forward from the previous RNG object's state by jumppoly (optional) number of steps. If jumppoly is not provided, the default jump polynomial moves the RNG state forward by 10^20 steps.

Note that the output will vary as it depends on the current state of the provided RNG object.

See Also

bitrand, MersenneTwister, rand, randcycle, randexp, randexp!, randjump, randn, randn!, RandomDevice, randperm, randsubseq, randsubseq!, shuffle, srand,

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field
Details

Checking you are not a robot: