run for random numbers and keep state [duplicate]
问题 This question already has answers here : Generate unique number within range (0 - X), keeping a history to prevent duplicates (4 answers) Closed 3 years ago . I use the following code to get random value from specifed range var provideRanges = function(){ var aa = []; _.times(3, function(i) { console.log(i); let num = _.random(10, 20) console.log("num = :" + num) debugger; aa.push(num); console.log("value is :" + aa[i]); }); } This is working and provide array of 3 values between the