setRandomSeed()
setRandomSeed(seed)
Since version 1.2, when Macaulay2 starts the random number seed is initially set to a number that depends on the current date, the time (in seconds), and the process id, except for when running examples and tests in packages, where it is always initialized to 0 by passing the command line option --no-randomize.
The sequence of future pseudo-random results is determined by the random number seed.
|
|
|
|
|
|
If an integer seed is given, the random number seed is set to the low-order 32 bits of the seed.
|
|
|
|
If a string seed is given, sets the random number seed to an integer computed from it. Every character of the string contributes to the seed, but only 32 bits of data are used. The sequence of future pseudo-random results is determined by the seed.
|
|
|
|
../../../../../Macaulay2/m2/system.m2:145:20-145:45: --source code:
setRandomSeed ZZ := seed -> randomSeed = seed -- magic assignment, calls rawSetRandomSeed internally
../../../../../Macaulay2/m2/system.m2:146:24-146:85: --source code:
setRandomSeed String := seed -> setRandomSeed fold((i,j) -> 101*i + j, 0, ascii seed)
../../../../../Macaulay2/m2/system.m2:147:26-147:104: --source code:
setRandomSeed Sequence := seed -> if seed === () then rawRandomInitialize() else setRandomSeed hash seed
The object setRandomSeed is a method function with a single argument.