udp load test: use Gamma distribution for torrent selection

This commit is contained in:
Joakim Frostegård 2022-10-26 19:45:39 +02:00
parent 15f8d30518
commit 2b9db63984
5 changed files with 22 additions and 17 deletions

View file

@ -1,9 +1,9 @@
use rand::prelude::*;
use rand_distr::Pareto;
use rand_distr::Gamma;
use aquatic_udp_protocol::*;
pub fn pareto_usize(rng: &mut impl Rng, pareto: Pareto<f64>, max: usize) -> usize {
pub fn pareto_usize(rng: &mut impl Rng, pareto: Gamma<f64>, max: usize) -> usize {
let p: f64 = rng.sample(pareto);
let p = (p.min(101.0f64) - 1.0) / 100.0;