Use gamma distribution for all load testers

This commit is contained in:
Joakim Frostegård 2022-10-26 19:49:30 +02:00
parent 2b9db63984
commit db561a1101
12 changed files with 65 additions and 55 deletions

View file

@ -3,8 +3,8 @@ use rand_distr::Gamma;
use aquatic_udp_protocol::*;
pub fn pareto_usize(rng: &mut impl Rng, pareto: Gamma<f64>, max: usize) -> usize {
let p: f64 = rng.sample(pareto);
pub fn gamma_usize(rng: &mut impl Rng, gamma: Gamma<f64>, max: usize) -> usize {
let p: f64 = rng.sample(gamma);
let p = (p.min(101.0f64) - 1.0) / 100.0;
(p * max as f64) as usize