samedi 11 juillet 2015

Making Decisions using Random

I am trying to create a random choice maker. I want my program to pick a random number then apply it to an if. Like this -

Random random = new Random();
random.next(0, 10).ToString());
if (random == 1)
{
messagebox.show("Good Joke")
}
else if(random == 2)
{
messagebox.show("Terrible Joke")
}

etc...

Could someone help please.




Aucun commentaire:

Enregistrer un commentaire