+ 1

How does random work in JS?

2nd Apr 2017, 8:35 AM
MisterMM23
2 Answers
+ 21
Math.random() gives a random number between 0 and 1 (like : 0.35333543) Math.round(Math.random()*(b-a)+a) //random rounded number between "a" and "b"
2nd Apr 2017, 8:43 AM
Valen.H. ~
Valen.H. ~ - avatar
+ 3
Ok thanks!
2nd Apr 2017, 8:44 AM
MisterMM23