aboutsummaryrefslogtreecommitdiffstats
path: root/src/string
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2016-02-29 16:15:28 +0100
committerMattias Andrée <maandree@kth.se>2016-02-29 16:15:28 +0100
commit37bcca6d99f4088e70e4247967e5f1320832447d (patch)
treec426947b3c200192738512253dfd7215669bc35d /src/string
parentfix terrible mistake in bsearch (diff)
downloadslibc-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 'src/string')
-rw-r--r--src/string/strfry.c2
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;