//*** This code is copyright 2003 by Gavin Kistner, gavin@refinery.com //*** It is covered under the license viewable at http://phrogz.net/JS/_ReuseLicense.txt //*** Reuse or modification is free provided you abide by the terms of that license. //*** (Including the first two lines above in your source code satisfies the conditions.) // Returns a random number from 0 to maxVal // Pass true as second parameter for float; pass false (or omit) for integer value Math.randomMax = function(maxVal,float){ var val = Math.random()*maxVal; return float?val:Math.round(val); }