WorthyD
6/2/2014 - 10:04 AM

RandomNumbers.js

var RandomNumbers =(function(w){
    return {
        //l = low
        //h = high
        GetInt: function (l, h) {
            return l + w.Math.floor(Math.random() * (h - l));
        },
        GetFloat: function (l, h) {
            return l + w.Math.random() * (h - l);
        }
    };
})(window); 
 
 
/*
Usage
 
//Get random whole number between 1 and 10
 var x = RandomNumbers.GetInt(1, 10);
 
 //Get random number w/ decimal between 1 and 10
 var x = RandomNumbers.GetFloat(1, 10);

*/