Skip to content

RAND

  • seed: This optional parameter is a positive integer that determines the start point from which the RAND() function generates a random number sequence. If the seed value is provided, the function will produce a predictable sequence of random numbers each time the MySQL server starts. However, if this seed parameter is not specified, RAND() will produce a new random number on each call.
SELECT RAND();
+------------------+
| RAND() |
+------------------+
|0.734526838547049 |
+------------------+

The RAND() function in MySQL returns a random floating-point value between 0 and 1. In the provided example, the RAND() function has returned 0.734526838547049 as a random number. Each execution of the RAND() function may return a different number as it generates a random float value.