Javascript Number toRandom(lowerBound, upperBound)

Description

Javascript Number toRandom(lowerBound, upperBound)


Number.prototype.toRandom = function(lowerBound, upperBound) {
  var range = upperBound - lowerBound;
  return Math.floor(lowerBound + Math.random() * (1+range)) ;
};



PreviousNext

Related