Skip to content

Instantly share code, notes, and snippets.

View joeyred's full-sized avatar

Brian Hayes joeyred

View GitHub Profile
@kerimdzhanov
kerimdzhanov / random.js
Last active April 20, 2024 03:21
JavaScript: get a random number from a specific range
/**
* Get a random floating point number between `min` and `max`.
*
* @param {number} min - min number
* @param {number} max - max number
* @return {number} a random floating point number
*/
function getRandomFloat(min, max) {
return Math.random() * (max - min) + min;
}