Math.randomMax = function(maxVal,asFloat){ var val = Math.random()*maxVal; return asFloat?val:Math.round(val); }