From fedc34128bd8be38190ee70d7e308566f9076ab0 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 26 Mar 2016 13:12:02 +0100 Subject: m MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/string/strfry.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') 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. */ -- cgit v1.2.3-70-g09d2