WordPress Hosting
Free Photos
WordPress Themes

Generating random numbers

/** * Returns a random number between min and max */ function getRandomArbitary (min, max) { return Math.random() * (max - min) + min; } /** * Returns a random integer between min and max * Using Math.round() will give you a non-uniform distribution! */ function getRandomInt (min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.