Created
October 13, 2019 09:37
-
-
Save RinatValiullov/57187cd6cc621382a49843f755cef641 to your computer and use it in GitHub Desktop.
Get pool of random numbers
This file contains hidden or 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
let generateRandomNumbers = (quantity) => { | |
let randomValues = { | |
[Symbol.iterator]: function() { | |
return { | |
next: function() { | |
return { value: ~~(Math.random() * quantity) }; | |
} | |
} | |
} | |
}; | |
return randomValues; | |
}; | |
let random_pool = []; | |
for(let item of generateRandomNumbers(100)) { | |
random_pool.push(item); | |
if(random_pool.length === 100) { break; } | |
} | |
console.log(random_pool); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment