DarkPhoenix,
const makeRandomFn = (...a) => (a = [].concat(...a), () => a[Math.random() * a.length|0]);
const getRandomNumber = makeRandomFn([1, 2, 100, 34, 45, 556, 33])
console.log(getRandomNumber());
console.log(getRandomNumber());
console.log(getRandomNumber());
const makeRandomFn = (...a) => (a = [].concat(...a), () => a[Math.random() * a.length|0]);
const getRandomNumber = makeRandomFn(1, 2, 100, 34, 45, 556, 33)
console.log(getRandomNumber());
console.log(getRandomNumber());
console.log(getRandomNumber());
const makeRandomFn = function() {
const a = [].concat.apply([],arguments);
return function() {
return a[Math.random() * a.length|0]
}};
const getRandomNumber = makeRandomFn(1, 2, 100, 34, 45, 556, 33)
console.log(getRandomNumber());
console.log(getRandomNumber());
console.log(getRandomNumber());
const makeRandomFn = function() {
const a = [].concat.apply([],arguments);
return function() {
return a[Math.random() * a.length|0]
}};
const getRandomNumber = makeRandomFn([1, 2, 100, 34, 45, 556, 33])
console.log(getRandomNumber());
console.log(getRandomNumber());
console.log(getRandomNumber());