normal distribution
authorNathan S. Evans <evans@in.tum.de>
Mon, 25 Jul 2011 14:34:51 +0000 (14:34 +0000)
committerNathan S. Evans <evans@in.tum.de>
Mon, 25 Jul 2011 14:34:51 +0000 (14:34 +0000)
src/testing/testing_group.c

index b9ccf69f2d44d2bea37434df06a7d444e4124512..21a486054a535d242bc962454e273c21670ee9b0 100644 (file)
@@ -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);
     }