GetState - Maple Help

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}}\right]$ (1)
 > $s≔\mathrm{GetState}\left(\right)$
 ${s}{≔}\left[{5489}{,}{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}{,}{\dots }{,}{\text{⋯ 525 Array(0 .. 624) entries not shown}}\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)