RAND(), RAND(N) returns a random floating-point value v in the range 0 : RAND : Math Numeric Functions MySQL TUTORIALS


MySQL TUTORIALS » Math Numeric Functions » RAND »

 

RAND(), RAND(N) returns a random floating-point value v in the range 0


If a constant integer argument N is specified, it is used as the seed value, which produces a repeatable sequence of column values.

mysql>
mysql> SELECT RAND();
+------------------+
| RAND()           |
+------------------+
0.72570215698863 |
+------------------+
row in set (0.00 sec)

mysql>
mysql> SELECT RAND(20);
+------------------+
| RAND(20)         |
+------------------+
0.15888261251047 |
+------------------+
row in set (0.00 sec)

mysql>
mysql> SELECT RAND(20);
+------------------+
| RAND(20)         |
+------------------+
0.15888261251047 |
+------------------+
row in set (0.00 sec)

mysql>
mysql> SELECT RAND();
+------------------+
| RAND()           |
+------------------+
0.49934750655605 |
+------------------+
row in set (0.00 sec)

mysql>
mysql> SELECT RAND();
+------------------+
| RAND()           |
+------------------+
0.31963109254803 |
+------------------+
row in set (0.00 sec)



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

MySQL TUTORIALS

 Navioo Math Numeric Functions
» RAND