Set the internal state of the Mersenne Twister Generator - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Random Objects : RandomTools package : MersenneTwister Subpackage : RandomTools/MersenneTwister/SetState

RandomTools[MersenneTwister][SetState] - Set the internal state of the Mersenne Twister Generator

Calling Sequence

SetState( option )

Parameters

option

-

(optional) argument of the form option=value where option is state

Description

• 

The SetState command sets the state of the internal Mersenne Twister random number generator.

• 

A state returned by GetState can be passed into SetState to regenerate a sequence of numbers.

• 

SetState accepts one optional argument, state.

  

state=integer or rtable

  

The state argument specifies the data used to set the state of the generator.  If the value of state is an integer, then the integer is used to seed the state.  If the value of state is an rtable that was returned by GetState, then the state is set to the value stored in the rtable.  If the state argument is not given then the state is seeded using values taken from the system.

Examples

withRandomTools[MersenneTwister]

GenerateData,GenerateFloat,GenerateFloat64,GenerateInteger,GenerateInteger32,GenerateUnsignedInt32,GetState,NewGenerator,SetState

(1)

s:=GetState

s:= 0 .. 624 ArrayData Type: integer4Storage: rectangularOrder: Fortran_order

(2)

seqGenerateInteger,i=1..5

395718860534,193139816415,22424170465,800187484459,427552056869

(3)

SetStatestate=1234567

seqGenerateInteger,i=1..5

633358104191,499773630790,300352444386,416305631357,412579138445

(4)

SetStatestate=1234567

seqGenerateInteger,i=1..5

633358104191,499773630790,300352444386,416305631357,412579138445

(5)

SetStatestate=s

seqGenerateInteger,i=1..5

395718860534,193139816415,22424170465,800187484459,427552056869

(6)

See Also

rand, RandomTools, RandomTools[Generate], RandomTools[GetState], RandomTools[MersenneTwister], RandomTools[MersenneTwister][GenerateInteger], RandomTools[MersenneTwister][GetState], RandomTools[SetState]


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam