Skip to content

Commit 2c82013

Browse files
ww-oaiRalith
authored andcommitted
Switch BBR RNG to PCG
1 parent 544dd9e commit 2c82013

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

quinn-proto/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ lru-slab = { workspace = true }
5050
qlog = { workspace = true, optional = true }
5151
rustc-hash = { workspace = true }
5252
rand = { workspace = true }
53+
rand_pcg = "0.10"
5354
ring = { workspace = true, optional = true }
5455
rustls = { workspace = true, optional = true }
5556
rustls-platform-verifier = { workspace = true, optional = true }
@@ -69,7 +70,6 @@ web-time = { workspace = true }
6970
[dev-dependencies]
7071
assert_matches = { workspace = true }
7172
hex-literal = { workspace = true }
72-
rand_pcg = "0.10"
7373
rcgen = { workspace = true }
7474
tracing-subscriber = { workspace = true }
7575
lazy_static = "1"

quinn-proto/src/congestion/bbr/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use std::any::Any;
22
use std::fmt::Debug;
33
use std::sync::Arc;
44

5-
use rand::rngs::{StdRng, SysRng};
6-
use rand::{Rng, RngExt, SeedableRng};
5+
use rand::{RngExt, SeedableRng};
6+
use rand_pcg::Pcg32;
77

88
use crate::congestion::ControllerMetrics;
99
use crate::congestion::bbr::bw_estimation::BandwidthEstimation;
@@ -57,7 +57,7 @@ pub struct Bbr {
5757
bw_at_last_round: u64,
5858
round_wo_bw_gain: u64,
5959
ack_aggregation: AckAggregationState,
60-
random_number_generator: StdRng,
60+
random_number_generator: Pcg32,
6161
}
6262

6363
impl Bbr {
@@ -98,7 +98,7 @@ impl Bbr {
9898
bw_at_last_round: 0,
9999
round_wo_bw_gain: 0,
100100
ack_aggregation: AckAggregationState::default(),
101-
random_number_generator: StdRng::try_from_rng(&mut SysRng).unwrap(),
101+
random_number_generator: Pcg32::from_rng(&mut rand::rng()),
102102
}
103103
}
104104

0 commit comments

Comments
 (0)