1st is the simplest, number is the interval of to 0 - to 'number', like if want to sort to 10 or to 100 or to 1000, or if you want draw lots just 6 friends:
function ram (number) {
return Math.floor(Math.random()*number);
}
2nd we want to draw lots between two limits, for instance of 7 till 25:
function random(begging, end) {
let xz1 = Math.floor(Math.random()*(end+1));
if(xz1<begging){
while(xz1<begging){
return random(begging,end);
}
}else {
return xz1;
}
}
But have other way, is you create an loop to store all the numbers that will be sort and they gotting a place in a array, so the first number is the 9 but will be in the itemArray[0], and create a function that sort the index and return the number inside the item idexed. Rute Bezerra de Menezes Gondim
No comments:
Post a Comment