18.07.2014, 21:28
Scrambles a string.
Areas of use:
This is as efficient as I could make it, without heavy use of arrays or similar.
Areas of use:
- Word contests
- RCON security (e.g. scramble the RCON password every few days).
- Scramble games (e.g. players get a few minutes to descramble and guess the word).
pawn Код:
stock strscramble(src[])
{
new
dest[128],
idx,
j;
for (new l = strlen(src); idx != l; j ++) if (src[(j = random(l))]) {
dest[idx++] = src[j];
src[j] = 0;
}
return dest;
}