0

Math.random and Math.floor is not working.

this will not work: var num = Math.floor(Math.random(50)) I am a kid learning JavaScript but is fluent in Lua. Please post the solution to this code. :P

16th Oct 2016, 1:44 PM
Lua guy
3 ответов
+ 4
Math.random() will always return a number between 0 and 1, which you then floor down to 0. I guess technically it does work! Just kidding, what you probably want to do is Math.floor(Math.random()*50);
16th Oct 2016, 1:45 PM
Schindlabua
Schindlabua - avatar
0
I want a random number on anywhere between 50.
16th Oct 2016, 1:47 PM
Lua guy
0
Your syntax must look like this: Math.floor(Math.random ()*50) Hope it helped! ---Carmelo
17th Oct 2016, 5:01 PM
Carmelo Cellupica