If Java strings were mutable like Java arrays, I could just do
int i = r.nextInt(string.length - 1);
int temp = string;
string = string[i+1];
string[i+1] = temp;
and thereby swap the two characters directly.
In Haskell, I could do
newString string = (init front) ++ [head back] ++ [last front] ++ (tail back)
where (front, back) = span someRandomNumber string
which splits the string in half (I don't remember how to get random numbers off the top of my head), then takes everything but the last character of the first half, then the first character of the other half, then the last character of the first half, then the rest of the second half, and concatenates them all together.
Edit: Removed random italics.