So many solutions to this!
Here's my code for a reuseable function that takes in 3 arguments: the number of integers wanted in the array (length) and the range that the array should be comprised of (max and min).
function generateRandomArr(length, max, min) {
const resultsArr = [];
for (let i = 0; i < length; i++) {
const newNumber = Math.floor(Math.random() * (max - min)) + min;
resultsArr.includes(newNumber) ? length += 1 : resultsArr.push(newNumber);
}
return resultsArr;
}
generateRandomArr(10, 100, 0);
// this would give a list of 10 items ranging from 0 to 100
// for example [3, 21, 56, 12, 74, 23, 2, 89, 100, 4]