Nodejs Random Number Get randomMax()

Here you can find the source of randomMax()

Method Source Code

Number.prototype.randomMax = function() {
    return Math.floor(Math.random() * (this.valueOf() + 1));
}

Related

  1. getRandom(low, high)
    Number.prototype.getRandom = function(low, high){
      'use strict';
      var randomNumber;
      if((low === undefined) || (high === undefined)){
        low = 1;
        high = 10;
      randomNumber = Math.round(Math.random() * (high - low)) + low;
      return randomNumber;
    ...
    
  2. getRandom(low, high)
    Number.prototype.getRandom = function(low, high) {
        "use strict";    
        var randomNumber;
        if ((low === undefined) || (high === undefined)) {
            low = 1;
            high = 10;
        randomNumber = Math.round(Math.random() * (high - low)) + low;
        return randomNumber;
    ...
    
  3. getRandomInterval(min, max)
    Random.getRandomInterval(min, max){
        return Math.random() * (max - min) + min;
    
  4. getRandomNumber(min, max)
    var getRandomNumber = function (min, max){
      return Math.floor(Math.random() * max + min);
    
  5. getRandomNumberBinary()
    var getRandomNumberBinary = function() {
      var randomNumber = getRandomNumber(0, 15);
      var returnObject = { decimal: randomNumber, binario: pad(dec2bin(randomNumber), 4)}
      return returnObject;
    var getRandomNumber = function (min, max){
      return Math.floor(Math.random() * max + min);