Resets the random number generator seed.
Syntax |
Description |
---|---|
out = randreset; |
Resets the random number seed based on the clock time. This function returns the random number seed that was used. |
out = randreset(seed); |
Set the seed to a specific value |
Example
This example shows how to fix the seed used to generate a set of random numbers. Note that if the same seed number is used for both sets the random numbers will be the same.
set1 = matrix(5); set2 = matrix(5); randreset(23); for (i=1:5){ set1(i) = rand; } randreset(23); for (i=1:5){ set2(i) = rand; } ?set1; ?set2; result: 0.517298 0.669097 0.946963 0.184988 0.76546 result: 0.517298 0.669097 0.946963 0.184988 0.76546
See Also