Bug #89120 Misrepresented in Documentaion of RAND() function
Submitted: 5 Jan 2018 15:19 Modified: 5 Feb 2018 18:37
Reporter: walter cao Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:MySQL 5.5 OS:Debian
Assigned to: CPU Architecture:Any
Tags: Rand()

[5 Jan 2018 15:19] walter cao
Description:
This manual page(https://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html#function_rand) said that:
    "To obtain a random integer R in the range i <= R < j, use the expression FLOOR(i + RAND() * (j − i))"

I applied this expression to my code. Unfortunately, the return values of this expression also contained "j", and it led to a bug in my project. The right range of R is: [i,j].

I hope someone would check it and make it right.

How to repeat:
SELECT FLOOR(1 + (RAND() * 36));
Repeat it for many times, and you will get a 37.
[5 Jan 2018 18:37] MySQL Verification Team
Unable to get 37 after hundreds input on Linux and Windows 64-bit.
[6 Feb 2018 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".