The RAND function is a multiplicative linear congruential random number generator. See Park and Miller (1988), CACM 31(10),
pp. 1192-1201 and Press et al. (1992), Numerical Recipes in C (2nd edition, Chapter 7, pp. 279). The result of calling the
RAND function is a pseudo-random number n where 0 < n < 1 (neither 0.0 nor 1.0 can be the result).
When a connection is made to the server, the random number generator seeds an initial value. Each connection is uniquely seeded
so that it sees a different random sequence from other connections. You can also specify a seed value (integer-expression) as an argument. Normally, you should only do this once before requesting a sequence of random numbers through successive
calls to the RAND function. If you initialize the seed value more than once, the sequence is restarted. If you specify the
same seed value, the same sequence is generated. Seed values that are close in value generate similar initial sequences, with
divergence further out in the sequence.
Never combine the sequence generated from one seed value with the sequence generated from a second seed value, in an attempt
to obtain statistically random results. In other words, do not reset the seed value at any time during the generation of a
sequence of random values.
The RAND function is treated as a non-deterministic function. The query optimizer does not cache the results of the RAND function.
The following example produces five results that are near each other in value, and do not have a random distribution. For
this reason, calling the RAND function more than once with similar seed values is not recommended: