Use global probability of users connecting
This commit is contained in:
parent
b39811a089
commit
097383b54b
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
13
src/user.rs
13
src/user.rs
|
@ -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)
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue