Go to: Synopsis. Return value. Related. MEL examples.
seed
[string] int
seed is NOT undoable, NOT queryable, and NOT editable.
This command seeds the generation of random numbers allowing repeatable sequences of random numbers. The seed function affects rand, sphrand and gauss.
Multiple random number streams:
The stream-based variant of seed accepts a string parameter
which specifies the name of the random number stream to seed.
For more details on multiple random number streams please see
the rand function. Note that there is no need to seed a
stream upon creation because every stream created, including the
default stream, is first initialised to the same internal seed
value to ensure that every stream will generate identical results
when called with the exact same sequence of random calls.
int | The seed number |
seed 7718; // Result: 7718 // rand 1; // Result: 0.540686 // rand 1; // Result: 0.107317 // seed 7718; // Result: 7718 // rand 1; // Result: 0.540686 // rand 1; // Result: 0.107317 // string $s1 = "stream1"; // Result: stream1 // seed $s1 7718; // Result: 7718 // rand $s1 1; // Result: 0.540686 //