mercredi 25 mai 2016

How can I create a random class that includes an array of number and an array of strings

I am doing with a GUI button. When user click it, it will get number or a word randomly. I know how to do it with just numbers,but i don't know how to deal with both words and numbers.

int[] numbers = new int[5] { 100, 500, 1000, 5000, 20000};
Random rd = new Random();
int randomIndex = rd.Next(0, 5);
int randomNumber = numbers[randomIndex];
button1.Text = randomNumber.ToString(); 




Aucun commentaire:

Enregistrer un commentaire