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
randfunction does not expect any input arguments. -
The
randfunction is evaluated for each row if used in a WHERE clause. -
return type: double.
Example 1 - random function
SELECT rand() AS RANDOM from Archery WHERE sim=1
Output:
+-----------+-------------------+
| RANDOM | 0.891655403699787 |
+-----------+-------------------+