Created
August 7, 2020 21:11
-
-
Save funfunction/f7adf6e51cd5cff64aec150b329e84f2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
@func | |
generate an arr of random nums | |
- containing numbers only between the supplied min and max | |
@param {number} min - smallest num in arr | |
@param {number} max - largest num in arr | |
@param {number} len - length of the arr to create | |
@return {number[]} | |
*/ | |
export const genRandNums = (min, max, len) => { | |
const f = []; //final | |
for (let i = 0; i < len; i++) { | |
f.push(Math.floor(Math.random() * (max - min + 1)) + min); | |
} | |
return f; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment