# HG changeset patch # User Timo Sirainen # Date 1381509966 -10800 # Node ID 60543c769ff216f61487c40fffa9ece08fcd1284 # Parent 85763021565c811a34c10f674fcc9cd1026163b7 profile: Fixed weighted randomness generation. diff -r 85763021565c -r 60543c769ff2 src/profile.c --- a/src/profile.c Thu Oct 10 17:39:46 2013 +0300 +++ b/src/profile.c Fri Oct 11 19:46:06 2013 +0300 @@ -19,7 +19,7 @@ #define RANDN2(mu, sigma) \ (mu + (rand()%2 ? -1.0 : 1.0) * sigma * pow(-log(0.99999*RANDU), 0.5)) #define weighted_rand(n) \ - (int)RANDN2(n, 1.0) + (int)RANDN2(n, n/2) static void user_set_timeout(struct user *user);