There's this
piece of code that looks appetizing, it's providing a way to quickly scramble a string variable.
public static string Shuffle(this string str)
{
char[] array = str.ToCharArray();
Random rng = new Random();
int n = array.Length;
while (n > 1)
{
n--;
int k = rng.Next(n + 1);
var value = array[k];
array[k] = array[n];
array[n] = value;
}
return new string(array);
}
Unfortunately it's providing an extension method and must be defined inside a static non-generic class. Can it be modified to be integrated into a single stand-alone action script?
With the following description?
"Randomizes the characters within a FsmString variable. You might want to clean up the result with other actions in the case you used white spaces that might end at the beginning or the ending of your scrambled string variable."