When you have Math.floor(Math.random()*10)+1 its supposed to pick a random number between 1-10 from what I understand.
However, when I change the +1 to any number higher or lower then 1 I get the same result. Why is this? What does the +1 mean exactly?
The random number generator produces a value in the range of 0.0 <= n < 1.0. If you want a number between 1 and something you’ll need to apply a
+1offset.Generally you can use:
This will generate values between M and M + N – 1.
demo Fiddle