Hi. I needed to generate a random number between n and m using mysql, so I looked up the RAND() function at mysql.com. At the mysql website I found the following statement: Further down on the page I found the following: Is the second statement correct? RAND() can return 1.0 right? In that case the example in the second statement would be SELECT FLOOR(7+(1.0*6)) Code (markup): where the expression inside the parenthesis sums up to 13.0. SELECT FLOOR(13.0) returns 13 right? Thus, not between 7 and 12 (inclusive) Are the mysql website wrong, or am I missing something?
Hmmmm. Your example looks correct. Did you look at the comments below the documentation? People find errors all the time. Can you post a link to the version of the documentation you are looking at?
There is nothing about it in the comments.. The link is in the post, and here: http://dev.mysql.com/doc/refman/5.0/en/mathematical-functions.html
Found the bug report for it: http://bugs.mysql.com/bug.php?id=17502 Guess it will be fixed, someday..
Yeah its a documentation error. I dont think RAND() can produce a value of exactly 1, my guess is the first of the documentation is wrong.