SetState - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


RandomTools

  

SetState

  

Set the internal state of the RandomTools Generator

 

Calling Sequence

Parameters

Description

Examples

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 pseudo-random number generator used by Generate.  Currently the Mersenne Twister generator is used.

• 

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

• 

SetState accepts one optional argument, state.

  

state=value

  

The state argument specifies the data used to set the state of the generator.  This argument is passed on to the SetState method of the underlying pseudo-random number generator.  Currently the MersenneTwister[SetState] function is called.  If the state argument is not given then the state is seeded using values taken from the system.

Examples

withRandomTools

AddFlavor,BlumBlumShub,Generate,GenerateSimilar,GenerateSimilarODE,GetFlavor,GetFlavors,GetState,HasFlavor,LinearCongruence,MersenneTwister,QuadraticCongruence,RandomExpand,RemoveFlavor,SetState

(1)

sGetState

seqGenerateinteger,i=1..5

−104281139460,−306860183579,−477575829529,300187484465,−72447943125

(2)

SetStatestate=1234567

seqGenerateinteger,i=1..5

133358104197,−226369204,−199647555608,−83694368637,−87420861549

(3)

SetStatestate=1234567

seqGenerateinteger,i=1..5

133358104197,−226369204,−199647555608,−83694368637,−87420861549

(4)

SetStatestate=s

seqGenerateinteger,i=1..5

−104281139460,−306860183579,−477575829529,300187484465,−72447943125

(5)

See Also

rand

RandomTools

RandomTools[Generate]

RandomTools[GetState]

RandomTools[LinearCongruence][SetState]

RandomTools[MersenneTwister]

RandomTools[MersenneTwister][GenerateInteger]

RandomTools[MersenneTwister][SetState]