diff options
author | Mattias Andrée <maandree@kth.se> | 2016-02-29 16:15:28 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2016-02-29 16:15:28 +0100 |
commit | 37bcca6d99f4088e70e4247967e5f1320832447d (patch) | |
tree | c426947b3c200192738512253dfd7215669bc35d /src/string/strfry.c | |
parent | fix terrible mistake in bsearch (diff) | |
download | slibc-37bcca6d99f4088e70e4247967e5f1320832447d.tar.gz slibc-37bcca6d99f4088e70e4247967e5f1320832447d.tar.bz2 slibc-37bcca6d99f4088e70e4247967e5f1320832447d.tar.xz |
strfry: non-uniform random number generation
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | src/string/strfry.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/string/strfry.c b/src/string/strfry.c index 8463947..77a771f 100644 --- a/src/string/strfry.c +++ b/src/string/strfry.c @@ -43,7 +43,7 @@ char* strfry(char* anagram) for (i = strlen(anagram); --i;) { r = rand(); - j = (size_t)((double)r / ((double)RAND_MAX + 1) * (double)i); + j = (size_t)((double)r / ((double)RAND_MAX + 1) * (double)i); /* TODO This is not uniformally random. */ t = anagram[i], anagram[i] = anagram[j], anagram[j] = t; } return anagram; |