aboutsummaryrefslogtreecommitdiff
path: root/src/util/crypto_random.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-06-08 06:55:01 +0000
committerChristian Grothoff <christian@grothoff.org>2010-06-08 06:55:01 +0000
commit75515782d35eb20040d2d0ef678dd64ebee37ae8 (patch)
tree36f223f46158e1202c2a7179d66697aebfe45927 /src/util/crypto_random.c
parentdd736579aa058254ea1d8217a85b2166e5ebc71f (diff)
downloadgnunet-75515782d35eb20040d2d0ef678dd64ebee37ae8.tar.gz
gnunet-75515782d35eb20040d2d0ef678dd64ebee37ae8.zip
fix
Diffstat (limited to 'src/util/crypto_random.c')
-rw-r--r--src/util/crypto_random.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/util/crypto_random.c b/src/util/crypto_random.c
index 35dafd071..eea047ac6 100644
--- a/src/util/crypto_random.c
+++ b/src/util/crypto_random.c
@@ -99,9 +99,9 @@ GNUNET_CRYPTO_random_permute (enum GNUNET_CRYPTO_Quality mode, unsigned int n)
99 ret = GNUNET_malloc (n * sizeof (unsigned int)); 99 ret = GNUNET_malloc (n * sizeof (unsigned int));
100 for (i = 0; i < n; i++) 100 for (i = 0; i < n; i++)
101 ret[i] = i; 101 ret[i] = i;
102 for (i = 0; i < n; i++) 102 for (i = n - 1; i > 0; i--)
103 { 103 {
104 x = GNUNET_CRYPTO_random_u32 (mode, n); 104 x = GNUNET_CRYPTO_random_u32 (mode, i+1);
105 tmp = ret[x]; 105 tmp = ret[x];
106 ret[x] = ret[i]; 106 ret[x] = ret[i];
107 ret[i] = tmp; 107 ret[i] = tmp;