From 75515782d35eb20040d2d0ef678dd64ebee37ae8 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 8 Jun 2010 06:55:01 +0000 Subject: [PATCH] fix --- src/util/crypto_random.c | 4 ++-- 1 file 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) ret = GNUNET_malloc (n * sizeof (unsigned int)); for (i = 0; i < n; i++) ret[i] = i; - for (i = 0; i < n; i++) + for (i = n - 1; i > 0; i--) { - x = GNUNET_CRYPTO_random_u32 (mode, n); + x = GNUNET_CRYPTO_random_u32 (mode, i+1); tmp = ret[x]; ret[x] = ret[i]; ret[i] = tmp; -- 2.25.1