Last active
December 14, 2023 00:41
-
-
Save rogeruiz/c5e4ce65ef47076fe4e2 to your computer and use it in GitHub Desktop.
Now for something completely random
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
const MAX = 39; | |
const MIN = 33; | |
const COUNT = 200; | |
const nn = new Array(COUNT).fill(); | |
/** | |
* @param {any[]} a - An array to be used to create a new array of random | |
* values. The contents of the array is not modified. | |
* @returns {number[]} - An array of the same length passed in with random | |
* numbers at each index | |
*/ | |
const generateRandomness = (a) => { | |
return a.map((_) => { | |
return (Math.random() * (MAX - MIN) + MIN).toFixed(0); | |
}); | |
}; | |
const dd = generateRandomness(nn); | |
console.log(`[${dd.join(", ")}]`); | |
console.log(`Total random numbers: ${dd.length}`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment