<< distfun_seedget Random Number Generator distfun_streamget >>

Distfun >> Distfun > Random Number Generator > distfun_seedset

distfun_seedset

Set the current state of the current random number generator

Calling Sequence

distfun_seedset(s)
distfun_seedset(s1)
distfun_seedset(s1,s2)
distfun_seedset(s1,s2,s3,s4)

Parameters

s:

a m-by-1 matrix of doubles, integer value, the state of the current random number generator

s1,s2,s3,s4:

a 1-by-1 matrix of doubles, integer value, the state 1, 2, 3 or 4 of the current random number generator

Description

Depending on the current random number generator, the distfun_seedset function may accept different calling sequences.

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);

Examples

distfun_seedset(1)
distfun_normrnd(12,7,5,3)
// Set the seed to the same value...
distfun_seedset(1)
// ... we get the same output :
distfun_normrnd(12,7,5,3)

Authors


Report an issue
<< distfun_seedget Random Number Generator distfun_streamget >>