reset the seed for random number generators - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Random Objects : randomize

randomize - reset the seed for random number generators

Calling Sequence

randomize(r)

Parameters

r

-

(optional) positive integer

Description

• 

With a positive integer as an argument, randomize(n) will set the state of the random number generator by using the given value as the initial state in a linear congruence random number generator, and using that generator to build the state.  With no arguments, randomize() will use a number based on the system clock as the initial state of the linear congruence random number generator.

• 

The return value will be the initial state of the linear congruence random number generator.  Thus if n is specified the return value is n.

• 

randomize calls RandomTools[MersenneTwister][SetState].  It is more efficient to make this call directly than to call randomize.

• 

By passing the value returned by randomize into a subsequent call to randomize the same sequence of numbers will be generated.

• 

Since the no argument form of randomize() depends on the system clock, the same seed can be obtained if not enough time elapses between two consecutive calls to randomize().

Examples

Seed:=randomize

Seed:=142423255409400

(1)

rand

211446653040

(2)

rand

606113501189

(3)

randomizeSeed

142423255409400

(4)

rand

211446653040

(5)

See Also

LinearAlgebra[RandomMatrix], rand, RandomTools, RandomTools[GetState], RandomTools[MersenneTwister][SetState], RandomTools[SetState], randpoly, Statistics[RandomVariable], StringTools[Randomize]


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