Skip to content

Instantly share code, notes, and snippets.


Brian Hayes joeyred

View GitHub Profile
kerimdzhanov / random.js
Last active Jan 16, 2021
JavaScript: get a random number from a specific range
View random.js
* 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;
You can’t perform that action at this time.