UNIFORM
functionsupportedCore SQL functionsGenerates a uniformly-distributed pseudo-random number in the inclusive range [min, max].
Syntax
UNIFORM( <min> , <max> , <gen> )
Parameters
| Name | Required | Description |
|---|---|---|
min | required | A constant specifying the minimum value (inclusive) of the generated number. |
max | required | A constant specifying the maximum value (inclusive) of the generated number. |
gen | required | An expression that serves as a raw source of uniform random numbers, typically the RANDOM function. For more information, see the Data Generation Functions Usage notes. |
Returns
If either or both of min or max is a floating-point number, UNIFORM returns a floating-point number. If both min and max are integers, UNIFORM returns an integer.
Usage notes
- This function is related to, but different from, the RANDOM function. Both functions generate uniform distributions, but there are differences in the ranges of the values returned.
- RANDOM generates pseudo-random 64-bit integers. It accepts an optional seed that allows sequences to be repeated.
- UNIFORM generates random integer or floating-point numbers in the specified range.