Returns a random floating-point value v between 0 and 1 inclusive (that is, in the range 0 <= v <= 1.0). If an integer argument N is specified, it is used as the seed value, which produces a repeatable sequence.
mysql> SELECT RAND();
-> 0.9233482386203
mysql> SELECT RAND(20);
-> 0.15888261251047
mysql> SELECT RAND(20);
-> 0.15888261251047
mysql> SELECT RAND();
-> 0.63553050033332
mysql> SELECT RAND();
-> 0.70100469486881
mysql> SELECT RAND(20);
-> 0.15888261251047
To obtain a random integer R in the range i <= R <= j, use the expression FLOOR(i + RAND() * (j – i). For example, to obtain a random integer in the range of 7 to 12 inclusive, you could use the following statement: SELECT FLOOR(7 + (RAND() * 5)); 将discuz论坛中所有贴子的浏览数改为13~93之间 update cdb_threads set views=FLOOR( 13+(RAND() * 80));
No Responses (yet)
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.