Skip to content

Instantly share code, notes, and snippets.

@funfunction
Created August 7, 2020 21:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save funfunction/f7adf6e51cd5cff64aec150b329e84f2 to your computer and use it in GitHub Desktop.
Save funfunction/f7adf6e51cd5cff64aec150b329e84f2 to your computer and use it in GitHub Desktop.
/**
@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