samedi 2 janvier 2016

how to create a random generated alphabet in Java

Looking to create a randomly generated alphabet for a substitution cipher. My idea was something like this.

        char randomChar = (char) (97 + r.nextInt(25));

However this will cause repetition of letters. Going through the char array and seeing if the letter is already present seems inefficient also.




Aucun commentaire:

Enregistrer un commentaire