mercredi 27 avril 2016

I need help width the Random code [duplicate]

This question already has an answer here:

I need help width the Random r = new Random(); code.

I will give you my code and tell you what I want to do.

Random r = new Random();
int i = r.nextInt(3);
System.out.println(i);

//now how do i make it not to take 0 as a random number
//One of them is 0, how do i make it take a random int that is
//bigger than 0 but lower than 3. I need help there.




Aucun commentaire:

Enregistrer un commentaire