# Is this hint right?

#1

First we use Math.random() to create a random number from 0 up to 1. For example, 0.5;
Then we multiply by 5 to make the random number from 0 up to 5. For example, 0.5 * 5 = 2.5;
Next we use Math.floor() to round down to a whole number. For example, Math.floor( 2.5 ) = 2;

I can understand the above three, but the below one:

Finally we add 1 to change the range from between 0 and 4 to between 1 and 5 (up to and including 5);

Isn't it supposed to be:

Finally we add 1 to change the range from between 0 and 5 to between 1 and 6 (up to and including 6) ?

#2

the code is: Math.floor(Math.random()*5+1)

#3

no, 6 is not included. Math floor generates a random number between 0 and 1 ( so zero and 1 not included), so lets say the highest possible value is: `0.999999` (might be even more nines, doesn't matter)

then 0,999999 * 5 + 1 = 5,999995

then we floor this number (floor means rounding down) so we will get 5

#4

Ok, I understand. The difference between the above hint and your explain is, the hint says "from 0 up to 1", which I think includes 0 and 1, while you said "between 0 and 1", which not includes 0 and 1. I'm not a native English speaker, so is this description of the hint correct? Or am I misunderstanding the hint meaning? Thank you.

#5

the description of the hint is fine.

#6

Ok, thank you.

#7