[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Fix biased shuffle by avoiding already "struck" elements
|
From: |
Sergei Trofimovich |
|
Subject: |
Re: [PATCH] Fix biased shuffle by avoiding already "struck" elements |
|
Date: |
Wed, 19 Jun 2024 22:37:48 +0100 |
On Wed, 19 Jun 2024 10:55:53 -0400
Dmitry Goncharov <dgoncharov@users.sf.net> wrote:
> On Tue, Jun 18, 2024 at 5:38 PM Sergei Trofimovich <slyich@gmail.com> wrote:
> > After the change probabilities are not as biased:
> >
> > 0 1 2 3
> > _____ _____ _____ _____
> > 0 | 24.99 24.99 25.01 25.01
> > 1 | 24.99 25.04 24.99 24.99
> > 2 | 25.01 25.00 25.00 24.99
> > 3 | 25.01 24.98 25.00 25.01
> >
>
> Looks like you wrote a program to figure out these probabilities.
> Should such a program be included as a part of make test suite?
I wrote a one-off `a.c` printer (attached).
It might be tricky to write safe ranges for probabilities: 4% is
"obviously" biased, but 0.02% is trickier (PRNG / modulo bias,
truncation, or expected deviation).
Glancing at tests/ all the tests exercise user-facing `make` API. What
would be the best way to validate probabilities?
--
Sergei
a.c
Description: Text Data