Fix selection of user's country
This commit is contained in:
parent
b6a80c9b7d
commit
dbf7dfe929
|
@ -49,7 +49,7 @@ impl User {
|
||||||
let submits_reports = num < state.prob_user_submits_reports;
|
let submits_reports = num < state.prob_user_submits_reports;
|
||||||
|
|
||||||
// Probabilistically decide user's country
|
// Probabilistically decide user's country
|
||||||
let num: f64 = rng.gen_range(0.0..1.0);
|
let mut num: f64 = rng.gen_range(0.0..1.0);
|
||||||
let cc = {
|
let cc = {
|
||||||
let mut cc = String::default();
|
let mut cc = String::default();
|
||||||
for (country, prob) in &state.probs_user_in_country {
|
for (country, prob) in &state.probs_user_in_country {
|
||||||
|
@ -58,7 +58,7 @@ impl User {
|
||||||
cc = country.to_string();
|
cc = country.to_string();
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
prob -= num;
|
num -= prob;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cc
|
cc
|
||||||
|
|
Loading…
Reference in New Issue