aboutsummaryrefslogtreecommitdiffstats
path: root/src/string/strfry.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/string/strfry.c')
-rw-r--r--src/string/strfry.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/string/strfry.c b/src/string/strfry.c
index 77a771f..f8b5b2c 100644
--- a/src/string/strfry.c
+++ b/src/string/strfry.c
@@ -19,7 +19,7 @@
#include <stdlib.h>
-/* Sattolo Cycles. */
+/* Durstenfeld's algorithm. */
@@ -40,7 +40,7 @@ char* strfry(char* anagram)
char t;
if (anagram == NULL)
return NULL;
- for (i = strlen(anagram); --i;)
+ for (i = strlen(anagram); i; i--)
{
r = rand();
j = (size_t)((double)r / ((double)RAND_MAX + 1) * (double)i); /* TODO This is not uniformally random. */