+ 2
I need to know how to make a random number (in a range of 0-9)
3 Respostas
+ 2
function randomIntFromInterval(min,max)
{
return Math.floor(Math.random()*(max-min+1)+min);
}
var random = randomIntFromInterval(0,9);
in the place of min and max with this function you can have any number between two numbers randomly. in my example is from 0 till 9
+ 2
Try this
randomNum = ~~(Math.random()*10);
0
import random
random_number = random. randint(0,9)
print(random_number)