Nodejs Random Number Get getRandomNumberBinary()

Here you can find the source of getRandomNumberBinary()

Method Source Code

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);
}

Related

  1. getRandom
    ===
    
  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. 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;
    ...
    
  4. getRandomInterval(min, max)
    Random.getRandomInterval(min, max){
        return Math.random() * (max - min) + min;
    
  5. getRandomNumber(min, max)
    var getRandomNumber = function (min, max){
      return Math.floor(Math.random() * max + min);
    
  6. randomMax()
    Number.prototype.randomMax = function() {
        return Math.floor(Math.random() * (this.valueOf() + 1));