Set the current state of the current random number generator
distfun_seedset(s) distfun_seedset(s1) distfun_seedset(s1,s2) distfun_seedset(s1,s2,s3,s4)
a m-by-1 matrix of doubles, integer value, the state of the current random number generator
a 1-by-1 matrix of doubles, integer value, the state 1, 2, 3 or 4 of the current random number generator
Depending on the current random number generator, the distfun_seedset function may accept different calling sequences.
"mt"
A simple calling sequence is :
distfun_seedset(s1)
Another calling sequence is :
distfun_seedset(s)
"kiss" :
The calling sequence is :
distfun_seedset(s1,s2,s3,s4)
distfun_seedset(s)
"clcg2"
The calling sequence is :
distfun_seedset(s1,s2)
distfun_seedset(s)
"clcg4"
The calling sequence is :
distfun_seedset(s1,s2,s3,s4)
distfun_seedset(s)
"urand"
The calling sequence is :
distfun_seedset(s1)
"fsultra"
A simple calling sequence is :
distfun_seedset(s1,s2)
distfun_seedset(s)
The complete calling sequence is :
distfun_seedset(s)
"crand"
The calling sequence is :
distfun_seedset(s1)
If the arguments s, s1, s2, s3 or s4 have a fractional part (i.e. do not have an integer value), or if there are not in the range of possible values, then an error is generated.
Setting the seed may be useful to get reproductible or less reproductible random numbers.
The pseudo random number generators are based on deterministic sequences. In order to get reproducible simulations, when we start Scilab, the initial seed of the generator is constant, such that the sequence will remain the same from a session to the other. Hence, by default, the first numbers produced by distfun are always the same.
In some situations, we may want to initialize the seed of the generator in order to produce less predictible numbers. In this case, we may initialize the seed with the output of the getdate function:
n=getdate("s"); distfun_seedset(n);