Nodejs Random Number Get GetRandomNum(Min, Max)

Here you can find the source of GetRandomNum(Min, Max)

Method Source Code

function GetRandomNum(Min, Max) {
   var Range = Max - Min;
   var Rand = Math.random();
   return (Min + Math.round(Rand * Range));
}

Related

  1. random(min, max)
    function random(min, max) {
       return Math.floor(Math.random() * (max - min + 1)) + min;
    
  2. random(min, max)
    function random(min, max) {
      return Math.floor(Math.random() * max) + min;
    
  3. randomBetween(N, M)
    randomBetween = function(N, M) {
      return Math.floor(M + (1 + N - M) * Math.random());
    };
    
  4. randomBetween(min, max)
    Math.randomBetween = function(min, max) {
      return Math.floor(Math.random()*(max-min+1)+min);
    };
    
  5. randomGaussian(mean, standardDeviation)
    Math.randomGaussian = function(mean, standardDeviation) {
      if (Math.randomGaussian.nextGaussian !== undefined) {
        var nextGaussian = Math.randomGaussian.nextGaussian;
        delete Math.randomGaussian.nextGaussian;
        return (nextGaussian * standardDeviation) + mean;
      } else {
        var v1, v2, s, multiplier;
        do {
          v1 = 2 * Math.random() - 1; 
    ...
    
  6. getRandomArbitrary(min, max)
    function getRandomArbitrary(min, max) {
        return Math.random() * (max - min) + min;
    
  7. getRandom
    ===
    
  8. 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;
    ...
    
  9. 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;
    ...