Sunday, January 28, 2018

get random number between 400 and 480 in javascript

i am confused about Math.Random() in javascript in know that this function will return a number between 0 and 1


i am trying to return a number between 400 and 500 and what i did is this :


var y = Math.floor((Math.random() * 400) + 100);

but this code may return a value of 100 or 200
what is the best practice to create a number where the minimum is n0 and maximum is n1

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...