diff options
author | Alex Auvolat <alex@adnab.me> | 2024-03-15 17:40:18 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2024-03-15 17:40:18 +0100 |
commit | 0fde35d584a4ff19db60e632ed0896848934659d (patch) | |
tree | f79e5ca6854650af4a9292cd330a75881e41f5f8 /src | |
parent | 4cd9081dc3a41594174480c1565fd2427550c50a (diff) | |
download | datagengo-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.rs | 6 |
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 { |