RandomTools - Maple Programming Help

Home : Support : Online Help : Programming : Random Objects : RandomTools package : Commands : RandomTools/GetState

RandomTools

 GetState
 Get the state of the RandomTools Generator

 Calling Sequence GetState( )

Description

 • The GetState command returns the internal state of the pseudo-random number generator used by Generate.  Currently the Mersenne Twister generator is used.
 • The state returned by GetState can be passed into SetState to regenerate a sequence of numbers.

Examples

 > $\mathrm{with}\left(\mathrm{RandomTools}\right)$
 $\left[{\mathrm{AddFlavor}}{,}{\mathrm{BlumBlumShub}}{,}{\mathrm{Generate}}{,}{\mathrm{GenerateSimilar}}{,}{\mathrm{GenerateSimilarODE}}{,}{\mathrm{GetFlavor}}{,}{\mathrm{GetFlavors}}{,}{\mathrm{GetState}}{,}{\mathrm{HasFlavor}}{,}{\mathrm{LinearCongruence}}{,}{\mathrm{MersenneTwister}}{,}{\mathrm{QuadraticCongruence}}{,}{\mathrm{RandomExpand}}{,}{\mathrm{RemoveFlavor}}{,}{\mathrm{SetState}}{,}{\mathrm{genIntegrationExpression}}\right]$ (1)
 > $s≔\mathrm{GetState}\left(\right)$
  (2)
 > $\mathrm{seq}\left(\mathrm{Generate}\left(\mathrm{integer}\right),i=1..5\right)$
 ${-104281139460}{,}{-306860183579}{,}{-477575829529}{,}{300187484465}{,}{-72447943125}$ (3)
 > $\mathrm{SetState}\left(\mathrm{state}=s\right)$
 > $\mathrm{seq}\left(\mathrm{Generate}\left(\mathrm{integer}\right),i=1..5\right)$
 ${-104281139460}{,}{-306860183579}{,}{-477575829529}{,}{300187484465}{,}{-72447943125}$ (4)