Sunday, 28 January 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

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...