diff options
author | Mattias Andrée <maandree@kth.se> | 2016-03-01 23:19:36 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2016-03-01 23:19:36 +0100 |
commit | 11225d3b3202cc3a6a04eb92fd6f5f00a8354bbc (patch) | |
tree | c109c1879f64abe37b96a7149157f086646a0023 /src | |
parent | strfry: use Durstenfeld's algorithm instead of Satallo's algorithm (diff) | |
download | slibc-11225d3b3202cc3a6a04eb92fd6f5f00a8354bbc.tar.gz slibc-11225d3b3202cc3a6a04eb92fd6f5f00a8354bbc.tar.bz2 slibc-11225d3b3202cc3a6a04eb92fd6f5f00a8354bbc.tar.xz |
derp
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src')
-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 f8b5b2c..b46fb06 100644 --- a/src/string/strfry.c +++ b/src/string/strfry.c @@ -40,7 +40,7 @@ char* strfry(char* anagram) char t; if (anagram == NULL) return NULL; - for (i = strlen(anagram); i; i--) + for (i = strlen(anagram) - 1; i; i--) { r = rand(); j = (size_t)((double)r / ((double)RAND_MAX + 1) * (double)i); /* TODO This is not uniformally random. */ |