Use global probability of users connecting

This commit is contained in:
Vecna 2024-06-29 10:59:37 -04:00
parent b39811a089
commit 097383b54b
3 changed files with 11 additions and 5 deletions

View File

@ -28,6 +28,7 @@ pub struct Config {
pub prob_connection_fails: f64,
// If the connection fails, retry how many times?
pub num_connection_retries: u32,
pub prob_user_connects: f64,
pub prob_user_invites_friend: f64,
pub prob_user_submits_reports: f64,
pub prob_user_treats_throttling_as_blocking: f64,

View File

@ -56,6 +56,7 @@ pub struct Config {
pub one_positive_report_per_cred: bool,
pub prob_censor_gets_invite: f64,
pub prob_connection_fails: f64,
pub prob_user_connects: f64,
pub prob_user_invites_friend: f64,
pub prob_user_submits_reports: f64,
pub prob_user_treats_throttling_as_blocking: f64,
@ -103,6 +104,7 @@ pub async fn main() {
one_positive_report_per_cred: config.one_positive_report_per_cred,
prob_censor_gets_invite: config.prob_censor_gets_invite,
prob_connection_fails: config.prob_connection_fails,
prob_user_connects: config.prob_user_connects,
prob_user_invites_friend: config.prob_user_invites_friend,
prob_user_submits_reports: config.prob_user_submits_reports,
prob_user_treats_throttling_as_blocking: config.prob_user_treats_throttling_as_blocking,

View File

@ -59,7 +59,10 @@ pub struct User {
// Does the user submit reports to Troll Patrol?
submits_reports: bool,
// How likely is this user to use bridges on a given day?
// How likely is this user to use bridges on a given day? This has
// been converted to a global parameter (prob_user_connects), but we
// still leave the user implementation for now in case we want to
// switch back to it.
prob_use_bridges: f64,
// If the censor implements partial blocking, is the user blocked?
@ -90,8 +93,8 @@ impl User {
let (prob_use_bridges, submits_reports) = if is_censor {
(0.0, false)
} else {
let mut rng = rand::thread_rng();
let prob_use_bridges = rng.gen_range(0.0..=1.0);
// Use global value
let prob_use_bridges = config.prob_user_connects;
let submits_reports = event_happens(config.prob_user_submits_reports);
(prob_use_bridges, submits_reports)
};
@ -198,8 +201,8 @@ impl User {
let (prob_use_bridges, submits_reports) = if is_censor {
(0.0, false)
} else {
let mut rng = rand::thread_rng();
let prob_use_bridges = rng.gen_range(0.0..=1.0);
// Use global value
let prob_use_bridges = config.prob_user_connects;
let submits_reports = event_happens(config.prob_user_submits_reports);
(prob_use_bridges, submits_reports)
};