I have a function that takes user input to tell it how many random numbers to output, and the range to make the random numbers between (say 1-90). The problem is that it will give repeat numbers, but I want only unique numbers. Does anyone know how I can change the code to achieve this?
function random() {
    let randomNums = [];
// Get how many random numbers to output
    let numBox = document.querySelector('.numBox').value;
// Get the highest number range should go to (ex. 1-70)
    let highestNumber = document.querySelector('.highestNumber').value;
// Loop to generate random numbers and push to randomNums array
    for (let i = 0; i < numBox; i++) {
        let num = Math.floor(Math.random() * highestNumber) + 1;
        randomNums.push(` ${num}`)  
    }     
// Sort numbers from lowest to highest
    randomNums.sort(function(a, b) {return a - b;});
// Output numbers
    document.querySelector('.randomOutput').innerHTML = randomNums;
}
 
     
     
     
    