How could i get this code to just give me ONE number between 0-9.
At the moment it prints 10 numbers between that 0-9 but i need it to just pick one number from 0-9
import java.lang.Math;
public class random {
public static void main(String args[])
{
int max = 9;
int min = 0;
int range = max - min + 1;
for (int i = 0; i < 9; i++) {
int rand = (int)(Math.random() * range) + min;
System.out.println(rand);
}
}
}
Aucun commentaire:
Enregistrer un commentaire