RandomTools
SetState
Set the internal state of the RandomTools Generator
Calling Sequence
Parameters
Description
Examples
SetState( option )
option
-
(optional) argument of the form option=value where option is state
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.
with⁡RandomTools
AddFlavor,BlumBlumShub,Generate,GenerateSimilar,GenerateSimilarODE,GetFlavor,GetFlavors,GetState,HasFlavor,LinearCongruence,MersenneTwister,QuadraticCongruence,RandomExpand,RemoveFlavor,SetState
s≔GetState⁡
seq⁡Generate⁡integer,i=1..5
−104281139460,−306860183579,−477575829529,300187484465,−72447943125
SetState⁡state=1234567
133358104197,−226369204,−199647555608,−83694368637,−87420861549
SetState⁡state=s
See Also
rand
RandomTools[Generate]
RandomTools[GetState]
RandomTools[LinearCongruence][SetState]
RandomTools[MersenneTwister]
RandomTools[MersenneTwister][GenerateInteger]
RandomTools[MersenneTwister][SetState]
Download Help Document