02.09.2014, 14:11
Quote:
This would actually be quite similar to a card shuffle algorithm actually why not look a few up and see if you can get it to work.
|

Here it is, it does exactly what you want:
pawn Code:
RandomizeWord(word[])
{
new tmp;
new r;
for(new i = strlen(word) - 1; i >= 0; i--)
{
r=random(strlen(word));
tmp = word[i];
word[i] = word[r];
word[r] = tmp;
}
}
pawn Code:
#include <a_samp>
public OnFilterScriptInit()
{
new word[9];
word = "Computer";
RandomizeWord(word);
printf("%s", word);
return true;
}
RandomizeWord(word[])
{
new tmp;
new r;
for(new i = strlen(word) - 1; i >= 0; i--)
{
r=random(strlen(word));
tmp = word[i];
word[i] = word[r];
word[r] = tmp;
}
}
Code:
[16:11:41] Loading filterscript 'comp.amx'... [16:11:41] Cpumeotr