function getRandomNumberBetween(min,max){ return Math.floor(Math.random()*(max-min+1)+min); } //usage example: getRandomNumberBetween(20,400);
Math.floor(Math.random() * 3);
//an equation that returns either 1 or -1 var number = (Math.floor(Math.random() * 2) * 2) -1;