Re: [PATCH] Fix biased shuffle by avoiding already "struck" elements

2024-07-09 Thread Sergei Trofimovich
On Fri, 21 Jun 2024 11:36:16 -0400 Dmitry Goncharov wrote: > On Fri, Jun 21, 2024 at 10:30 AM Paul Smith wrote: > > > > On Fri, 2024-06-21 at 09:11 -0400, Dmitry Goncharov wrote: > > > i hope, Paul approves adding tests of this nature. > > > > I have no problems with adding unit tests, as

Re: [PATCH] Fix biased shuffle by avoiding already "struck" elements

2024-06-21 Thread Dmitry Goncharov
On Fri, Jun 21, 2024 at 10:30 AM Paul Smith wrote: > > On Fri, 2024-06-21 at 09:11 -0400, Dmitry Goncharov wrote: > > i hope, Paul approves adding tests of this nature. > > I have no problems with adding unit tests, as long as we can find a way > to integrate it into the test suite in a

Re: [PATCH] Fix biased shuffle by avoiding already "struck" elements

2024-06-21 Thread Paul Smith
On Fri, 2024-06-21 at 09:11 -0400, Dmitry Goncharov wrote: > i hope, Paul approves adding tests of this nature. I have no problems with adding unit tests, as long as we can find a way to integrate it into the test suite in a reasonable way. But this particular thing doesn't really feel like a

Re: [PATCH] Fix biased shuffle by avoiding already "struck" elements

2024-06-21 Thread Dmitry Goncharov
On Wed, Jun 19, 2024 at 5:37 PM Sergei Trofimovich wrote: > Glancing at tests/ all the tests exercise user-facing `make` API. What > would be the best way to validate probabilities? For this type of code like shuffle, i like testing the function itself, directly. Just calling the function in a

Re: [PATCH] Fix biased shuffle by avoiding already "struck" elements

2024-06-19 Thread Sergei Trofimovich
On Wed, 19 Jun 2024 10:55:53 -0400 Dmitry Goncharov wrote: > On Tue, Jun 18, 2024 at 5:38 PM Sergei Trofimovich wrote: > > After the change probabilities are not as biased: > > > > 0 1 2 3 > > _ _ _ _ > > 0 | 24.99 24.99 25.01 25.01 > > 1

Re: [PATCH] Fix biased shuffle by avoiding already "struck" elements

2024-06-19 Thread Dmitry Goncharov
On Tue, Jun 18, 2024 at 5:38 PM Sergei Trofimovich 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

[PATCH] Fix biased shuffle by avoiding already "struck" elements

2024-06-18 Thread Sergei Trofimovich
From: Sergei Trofimovich Artem Klimov noticed that current shuffle implementation suffers from probability bias due to a typical bug in the shuffling implementation. When we consider already shuffled element we slightly bias their propability.