Get random within a range - Node.js Number

Node.js examples for Number:Random Number

Description

Get random within a range

Demo Code

Util.getRandom = function(min, max) {
    if(arguments.length > 1) {
        return Math.random() * (max - min) + min;
    } else {//w  w  w  . j  a va  2s .  c o m
        return Math.random() * min;
    }
}

Related Tutorials