RAND
The RAND function returns a random floating-point value between 0 and 1. An argument can be specified as an optional seed value.
The schema is SYSIBM.
- numeric-expression
- If numeric-expression is specified,
it is used as the seed value. The argument must be an expression that
returns a value of a built-in integer data type (SMALLINT or INTEGER).
The value must be between 0 and 2,147,483,646.
The argument can also be a character string or graphic string data type. The string input is implicitly cast to a numeric value of DECFLOAT(34) and then assigned to an INTEGER value.
The result of the function is a double precision floating-point number.
The result can be null; if the argument is null, the result is the null value.
A specific seed value, other than zero, will produce the same sequence of random numbers for a specific instance of a RAND function in a query each time the query is executed. The seed value is used only for the first invocation of an instance of the RAND function within a statement. RAND(0) is processed the same as RAND().
The RAND function is a not deterministic.
SELECT RAND(:HRAND)
FROM SYSIBM.SYSDUMMY1;
SELECT (RAND(:HRAND) * 10)
FROM SYSIBM.SYSDUMMY1;