aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/string/strfry.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/string/strfry.c b/src/string/strfry.c
index aa09d0b..39f53e6 100644
--- a/src/string/strfry.c
+++ b/src/string/strfry.c
@@ -35,13 +35,12 @@
*/
char* strfry(char* anagram)
{
- size_t i, j, n;
+ size_t i, j;
int r;
char t;
if (anagram == NULL)
return NULL;
- n = strlen(anagram);
- for (i = n - 1; n && i; i--)
+ for (i = strlen(anagram); i--;)
{
r = rand();
j = (size_t)((double)r / ((double)RAND_MAX + 1) * (double)i); /* TODO This is not uniformally random. */