rst

Syntax

int rst(int seed)

Arguments

seed
An integer seed value for the random number generator.

Return

Returns the seed value, after being modified internally by a random value.

Description

Calling rst sets the pseudo-random number generator to a new state which is a function of both the value of 'seed' and the previous state of the pseudo-random number generator. The C run-time library routine srand(1) is implicitly called at the start of each filter run to set the pseudo-random number generator to a fixed known state, so the result of each run with otherwise identical parameters will generally produce exactly the same result. If you want the result to be different on each run, then call rst(seed) with some unpredictable value of 'seed' - e.g. call rst(clock()) to seed the pseudo-random number generator from the elapsed time clock; or call rst(ctl(k)) to seed the pseudo-random number generator with the current value of control k; etc.

See Also

rand, srand