aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2024-03-15 17:40:18 +0100
committerAlex Auvolat <alex@adnab.me>2024-03-15 17:40:18 +0100
commit0fde35d584a4ff19db60e632ed0896848934659d (patch)
treef79e5ca6854650af4a9292cd330a75881e41f5f8 /src
parent4cd9081dc3a41594174480c1565fd2427550c50a (diff)
downloaddatagengo-0fde35d584a4ff19db60e632ed0896848934659d.tar.gz
datagengo-0fde35d584a4ff19db60e632ed0896848934659d.zip
random practice: just bring all chars to same proba, no overcompensation
Diffstat (limited to 'src')
-rw-r--r--src/server.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/server.rs b/src/server.rs
index 14368e0..76911f6 100644
--- a/src/server.rs
+++ b/src/server.rs
@@ -382,10 +382,8 @@ where
}
counted += 1;
- // compensate twice for rare characters
- // - once to bring all chars to equal probability of sampling
- // - once to over-sample rare chars because we need to see them more
- let weight = 1f64 / (*f * *f) as f64;
+ // compensate for rare characters
+ let weight = 1f64 / (*f) as f64;
total_weight += weight;
let rand: f64 = rng.gen();
if rand < weight / total_weight {