The function below addresses the perennial programming quandary: “How do
I take good data in string form and painlessly turn it into garbage?”
This is actually a fairly simple task for C programmers who do not use
the GNU C library string functions, but for programs based on the GNU C
strfry function is the preferred method for
destroying string data.
The prototype for this function is in string.h.
strfrycreates a pseudorandom anagram of a string, replacing the input with the anagram in place. For each position in the string,
strfryswaps it with a position in the string selected at random (from a uniform distribution). The two positions may be the same.
The return value of
strfryis always string.
Portability Note: This function is unique to the GNU C library.