Wonder can anyone give me at least whether im going in the right direction and maybe give me advice re the lab exercises Cypher 1 & 2.
I get the idea of using substrings and lengths to move the string input around but to truly muddle the input around my guess is that i need to create a String Array and use a For Loop to assign each character in the inputted String to a sequential string array variable using a sequential count on the String array variable and the charAt method. Then my guess is i can use the random class, using the length method to define the range in the random range, to output the inputted original in random order, which i propose doing using a While Loop.
However the difficulty is as i see it will be to prevent duplicate randoms occurring and therefore you get the same string character twice. I think (?) i know how to prevent duplicate randoms using While Loops which is ok for a small number of randoms such as in the Lotto program but if the inputted string is lengthy then this would be tricky.
So my first question is there a neat way to prevent duplicate randoms, my second question is whether this is a valid approach or have i gone on a complete tangent and missed some far more straightforward way of doing this?? Keeping Cypher2 in mind i see no other way than using the random class??
Thanks in advance for any hints