From: Nathan S. Evans Date: Mon, 25 Jul 2011 14:34:51 +0000 (+0000) Subject: normal distribution X-Git-Tag: initial-import-from-subversion-38251~17663 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=d2469f4bd8f26105392c7ccd110f38f6e2e8a8de;p=oweals%2Fgnunet.git normal distribution --- diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c index b9ccf69f2..21a486054 100644 --- a/src/testing/testing_group.c +++ b/src/testing/testing_group.c @@ -1385,6 +1385,7 @@ make_config(const struct GNUNET_CONFIGURATION_Handle *cfg, uint32_t off, char *allowed_hosts; unsigned long long skew_variance; unsigned long long skew_offset; + long long actual_offset; orig = *port; uc.nport = *port; @@ -1407,8 +1408,10 @@ make_config(const struct GNUNET_CONFIGURATION_Handle *cfg, uint32_t off, &skew_variance)) && (skew_variance > 0)) { - skew_variance *= 2; skew_offset = GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_WEAK, skew_variance + 1); + actual_offset = skew_offset - GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_WEAK, skew_variance + 1); + /* Min is -skew_variance, Max is skew_variance */ + skew_offset = skew_variance + actual_offset; /* Normal distribution around 0 */ GNUNET_CONFIGURATION_set_value_number(uc.ret, "testing", "skew_offset", skew_offset); }