Fn a first defined to return an integer in the range:
function getRand(a,b){ var rand = Math.ceil(Math.random()*(b-a)+a); return rand; }
To write a func used for recalibration:
function checkArrIn(rand,array){ if(array.indexOf(rand) > -1){ return true } return false; }
Finally, the overall implementation:
Fn function (n, min, max) { var ARR = []; var scanned using the ISNUM isNaN = (Number The (n));! // is not determined a number n, containing string-type Digital var isRandOk = (n> = ? min && n <= max && n <= (max - min)) true: false; // the value of n is determined to meet the requirements iF (n && && isRandOk scanned using the ISNUM) { for (var I = 0; I <n ; I ++) { var = RAND the getRand (min, max); IF (checkArrIn (RAND, ARR)) { i-- } the else { arr.push (RAND) } } } return ARR; }