diff options
Diffstat (limited to '')
-rw-r--r-- | src/string/strfry.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/string/strfry.c b/src/string/strfry.c index f020202..cf8d643 100644 --- a/src/string/strfry.c +++ b/src/string/strfry.c @@ -34,13 +34,16 @@ char* strfry(char* anagram) { size_t i, j; + int r; char t; if (anagram == NULL) return NULL; for (i = strlen(anagram); --i;) { - j = (int)((double)rand() / (RAND_MAX + 1)); + r = rand(); + j = (int)((double)r / (RAND_MAX + 1)); t = anagram[i], anagram[i] = anagram[j], anagram[j] = t; } + return anagram; } |