Generate an integer using the Mersenne Twister Generator - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Random Objects : RandomTools package : MersenneTwister Subpackage : RandomTools/MersenneTwister/GenerateInteger

RandomTools[MersenneTwister][GenerateInteger] - Generate an integer using the Mersenne Twister Generator

Calling Sequence

GenerateInteger( opt1, opt2, ... )

Parameters

opt1, opt2, ...

-

(optional) argument of the form option=value where option is range

Description

• 

The GenerateInteger command outputs a pseudo-random integer, generated using the MersenneTwister algorithm.

• 

When generating a large number of random integers it is faster to create a generating procedure by calling NewGenerator than to call GenerateInteger.

• 

The following optional arguments are supported. They are input as equations in any order.

• 

range=integer..integer or integer

  

If the value of the range argument is a range, then the integer is chosen from that range.  If the value of the range argument is an integer, then the integer is chosen from the range 0..value-1.  The default value is 1000000000000.

Examples

withRandomTools[MersenneTwister]

GenerateData,GenerateFloat,GenerateFloat64,GenerateInteger,GenerateInteger32,GenerateUnsignedInt32,GetState,NewGenerator,SetState

(1)

GenerateInteger

395718860534

(2)

GenerateInteger

193139816415

(3)

seqGenerateInteger,i=1..10

22424170465,800187484459,427552056869,842622684442,412286285840,996417214180,386408307450,694607189265,773012980023,730616292946

(4)

GenerateIntegerrange=1000..2000

1024

(5)

GenerateIntegerrange=1000..2000

1601

(6)

seqGenerateIntegerrange=1000..2000,i=1..5

1604,1827,1476,1397,1049

(7)

seqFloatGenerateIntegerrange=1010,10,i=1..5

0.8415955883,0.2816384844,0.8743315087,0.3646982597,0.4011470445

(8)

See Also

rand, RandomTools, RandomTools[BlumBlumShub], RandomTools[Generate], RandomTools[LinearCongruence] RandomTools[MersenneTwister], RandomTools[MersenneTwister][GenerateFloat64] RandomTools[MersenneTwister][GenerateFloat], RandomTools[MersenneTwister][GenerateInteger32] RandomTools[MersenneTwister][GenerateUnsignedInt32], RandomTools[MersenneTwister][NewGenerator] RandomTools[QuadraticCongruence]


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