Math.floor() . function?


#1
  • Math.floor(Math.random()5+1)**
    why is the range between 1 and 5 (up to and including 5), instead of between 1 and 6 (up to and including 6)??

If Math.random() creates a number 1, timesing 5 and +1 will give out 6 won't it???


#2

Remember Math.floor() rounds a number to lowest digit. So if 3.79, rounds to 3.


#3

yea soshudn'tit give a range b/w 1 to 6 rather than 1 to 5