+ 1

Help!

How to select a random number from 1-100? This is the example, I know its wrong var x = 100; var i = random.Math(x)*1; alert(i); Yeah! I know that is wrong. that is why i need your help. now tell me

31st Dec 2017, 2:21 AM
Cesar Fabular
Cesar Fabular - avatar
2 ответов
+ 1
Math.random()*x replace this in our code and it generates a floating point values if u want only decimal values use Math.floor() . I hope it will helps u
31st Dec 2017, 2:54 AM
NAGANDLA.LEELA PAVAN KUMAR
NAGANDLA.LEELA PAVAN KUMAR - avatar
+ 1
Thanks
31st Dec 2017, 2:55 AM
Cesar Fabular
Cesar Fabular - avatar