0
generate random number between (for example) 10 and 100
give me the simplest code for this solution.. thank you
4 ответов
+ 10
function randVal(min,max){
return Math.floor(Math.random()*(max-min+1)+min);
}
alert(randVal(10,100));
+ 4
var arr = [];
for (var n = 1; n < 51; n++)
arr.push(n);
function randArrDel(a) {
var i = Math.floor(a.length*Math.random());
return a.splice(i,1)[0];
}
for (c = 0; c < 20; c++)
console.log(randArrDel(arr));
0
thnx its work... how about generate random number (from 1 to 50) without repeat the same number in (maybe) 20 row
0
https://code.sololearn.com/WmQ4UuSIVNAd/?ref=app
I hope this code will help you