Question: I want to get random number between 65 to 122.I am using this query   

```
SELECT (FLOOR(65 + RAND() * 122));

```

after getting help from [this question](https://stackoverflow.com/questions/14865632/mysql-update-with-random-number-between-1-3) but it is giving me numbers outside the range of 65-122.  

Please help.Thanks

Answer: 
I think what you want is 

65 + FLOOR( RAND() \* 57 )

a minimum of 65 PLUS random of 0-57, so at the high end, 65 + 57 = 122
A typical way to write this is:

```
select 65 + FLOOR( RAND() * (122 - 65))

```

Writing it this way allows you to easily see the extreme values.

By the way, your question is a bit unclear as to whether 122 is included. The formula would be slightly different depending on that.