vendredi 9 septembre 2016

How to generate a random values and displays it in alphabet

i have a method that displays random numbers between 1 and 26 of a specified lenght.

 public string RandomDigits(int length)
    {
        var random = new Random();
        string s = string.Empty;

        for (int i = 0; i < length; i++)
            s = String.Concat(s, random.Next(1,27).ToString()+" ");

        return s;
    }

how can i display the returned value in alphabet. i.e the method returns

1 10 7 2 11

i want to get A J G B K




Aucun commentaire:

Enregistrer un commentaire