Return to Snippet

Revision: 29082
at July 21, 2010 03:01 by Jamie

Initial Code
// Random float between
function randomFloatBetween(minValue,maxValue,precision){
    if(typeof(precision) == 'undefined'){
        precision = 2;
    return parseFloat(Math.min(minValue + (Math.random() * (maxValue - minValue)),maxValue).toFixed(precision));

Initial URL

Initial Description
Simple function to return a decimal value between the minValue and the maxValue.

Initial Title
Random Number (Float) Generator

Initial Tags
number, function

Initial Language