JavaScript random number between minimum maximum number

JavaScript random number between minimum maximum number. Generate random number with given minimum and maximum number using Math.random and Math.floor function.

jQuery or JavaScript get random integer number by passing minimum and maximum number as parameter in function.

Example for generate random number with range

JavaScript
JavaScript

Function for generate random number with range

function getRandNumInRange(min, max)
{
    return Math.floor( Math.random() * (max-min + 1) + min );
}

var num = getRandNumInRange(10, 20);