Set the internal state of the Linear Congruence Generator - Maple Help

Online Help

All Products    Maple    MapleSim


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

RandomTools[LinearCongruence][SetState] - Set the internal state of the Linear Congruence 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 Linear Congruence pseudo-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

  

The state argument specifies the data used to set the state of the generator.  If the state argument is not given then the state is seeded using values taken from the system.

Examples

withRandomTools[LinearCongruence]

GenerateInteger,GetState,NewGenerator,SetState

(1)

s:=GetState

s:=1

(2)

seqGenerateInteger,i=1..5

427419669081,321110693270,343633073697,474256143563,558458718976

(3)

SetStatestate=1234567

seqGenerateInteger,i=1..5

218604127385,665262624842,52899550817,984396582721,705317627386

(4)

SetStatestate=1234567

seqGenerateInteger,i=1..5

218604127385,665262624842,52899550817,984396582721,705317627386

(5)

SetStatestate=s

seqGenerateInteger,i=1..5

427419669081,321110693270,343633073697,474256143563,558458718976

(6)

See Also

rand, RandomTools, RandomTools[Generate], RandomTools[GetState], RandomTools[LinearCongruence], RandomTools[LinearCongruence][GenerateInteger], RandomTools[LinearCongruence][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