It totally bugged out | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

It totally bugged out

If you put a number that not starts with "0." it will also keep showing, and if you put random zero's it will also stay. is this just a Math.random() fault? https://code.sololearn.com/WWOSf1csuhwA/?ref=app

25th Apr 2018, 9:02 AM
Roel
Roel - avatar
4 Answers
+ 2
function RandomRange(min,max){ return Math.floor(Math.random() * (++max-min) + min); } I think that is what you want.
25th Apr 2018, 9:48 PM
Nommer101
Nommer101 - avatar
+ 2
You define min and max when you call the function. console.log (RandomRange(0,100)); That way you can change is as you need it. min is the smallest number your random number can be and max is the biggest it can be.
25th Apr 2018, 10:18 PM
Nommer101
Nommer101 - avatar
0
min and max are not defined?
25th Apr 2018, 10:15 PM
Roel
Roel - avatar
0
thanks
25th Apr 2018, 10:52 PM
Roel
Roel - avatar