Second, this part is rather confusionary and not-so-good. Why += ? And are you trying to "shuffle" an array? It's possible but not in that way. You should not "tests whether the random letter is already in array", because it's not the right approach.

January 10th, 2014, 05:44 PM

llowe29

Re: Weird Characters printed

I made changes suggested though dont have any idea about array part. The weird characters(thanks:)) are gone but letters are beig repeated in alphabet.

I made changes suggested though dont have any idea about array part. The weird characters(thanks:)) are gone but letters are beig repeated in alphabet.

I repeat the question: are you trying to "shuffle" an array? It's easy to do and there is no need to use strange/unuseful internal loops to verify if "is already in array".

In general, given an array of N elements, do a for loop with an index that goes from N-1 to 1 (thus, decreasing). For each index in the loop, extract a random number k that is 0 <= k < index (this is exactly the result of rnd.nextInt(index) ;) ), and swap values at [index] and [k].