SetState - Maple Help

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

s5489,1301868182,−1356468075,−1344685418,1875628136,751856242,944701696,−2051775225,694061057,219885934,2066767472,−1112097888,485472502,−1958109413,1071588843,−876496698,951210697,−601408930,−1371485245,1793174584,−1312656495,1586906132,1951078751,1808158765,1733897588,431328322,−92428252,530658942,1714810322,−1269711012,−952381900,1937033938,−1654394785,1654299090,−602563743,−61095987,−797316502,862629010,−1351731264,−1868508751,1603307207,1133453895,−1195770936,−2086309667,−1547313369,931059398,761573964,−1137114069,785880413,730313442,124945756,−1357850241,−998984827,1724353043,−1273291952,−410080879,−284817198,−238005330,699635835,−1613628478,1339167484,720757518,−1494805820,−1918869923,1532957371,−392303197,1238982754,−569572782,−845790407,−724004825,−7331206,−207660284,−691623669,202242161,−1299284513,1620962684,−590243939,371613603,−1480132963,2111005706,624778151,2094172212,−10020293,1211977835,991917094,1570449747,−1332596816,1259410321,170182696,146300961,−1458137505,619452428,−1571297000,1881399711,1161269684,1675188680,−162792019,780088327,−885504475,1036518241,,⋯ 525 Array(0 .. 624) entries not shown

(2)

seqGenerateinteger,i=1..5

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

(3)

SetStatestate=1234567

seqGenerateinteger,i=1..5

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

(4)

SetStatestate=1234567

seqGenerateinteger,i=1..5

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

(5)

SetStatestate=s

seqGenerateinteger,i=1..5

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

(6)

See Also

rand

RandomTools

RandomTools[Generate]

RandomTools[GetState]

RandomTools[LinearCongruence][SetState]

RandomTools[MersenneTwister]

RandomTools[MersenneTwister][GenerateInteger]

RandomTools[MersenneTwister][SetState]