vendredi 12 mai 2017

Generating four numbers with no duplicates [duplicate]

This question already has an answer here:

I am trying to generate four different numbers for my text based survival game I am making for school. I am just having trouble with this part I have look at other similar questions but they want the four number, the number postal code and a bunch of other fancy stuff. I need just four numbers that are different. i was doing Math.random as so

>***'int event_W =(int)( Math.random()*10 + 1);

 int event_X =(int)( Math.random()*10 + 1);

 int event_Y =(int)( Math.random()*10 + 1);

 int event_Z =(int)( Math.random()*10 + 1);***

and the numbers cant be greater then ten or less then 0




Aucun commentaire:

Enregistrer un commentaire