To obtain a random integer in the range the range 7 <= R < 12 : RAND « Math Numeric Functions « MySQL Tutorial






mysql>
mysql> SELECT FLOOR(7 + (RAND() * 5));
+-------------------------+
| FLOOR(7 + (RAND() * 5)) |
+-------------------------+
|                       7 |
+-------------------------+
1 row in set (0.00 sec)

mysql>








21.30.RAND
21.30.1.RAND(), RAND(N) returns a random floating-point value v in the range 0 <= v < 1.0.
21.30.2.RAND(20)
21.30.3.To obtain a random integer in the range the range 7 <= R < 12