random function
The rand
function returns a positive pseudo-random number. The resultant value can be greater than or equal to zero and less than one.
Syntax:
double rand()
Semantics:
- The
rand
function does not expect any input arguments. - The
rand
function is evaluated for each row if used in a WHERE clause. - return type: double.
Example:
SELECT rand() AS RANDOM from Archery WHERE sim=1
Output:
+-----------+-------------------+
| RANDOM | 0.891655403699787 |
+-----------+-------------------+