mercredi 5 septembre 2018

c# random function only picks the first 3 out of 5 arrays

I'm trying to make a random alphabet selector using arrays and Random. but the random.Next function only picks the first 3 arrays out of 5 arrays.

char[] vowel = { 'a', 'e', 'i', 'o', 'u' };
    Random random = new Random();
    int select = random.Next(0, vowel.Length);
    textBox1.Text = vowel[select].ToString();

The output will always be "a", "e", or "i"; but never "o" and "u".

Sorry for bad english.




Aucun commentaire:

Enregistrer un commentaire