This addresses most of the issues from the review of v1 here:
https://listman.redhat.com/archives/libguestfs/2023-May/031520.html
* The filter now only handles 1e-12 <= P <= 1/8. Probabilities
outside this range are treated as 0% or 100% respectively. The
reasons are given in the code and man page, but basically are to do
with stopping things from blowing up. The restriction is not
essential - it might be fixed in future. I also added tests for
small and large probabilities.
* I did *not* change probability parsing or the "inf/nan" etc case or
return the numerator and denominator separately. The parsing could
be changed/fixed later. The API/ABI could not be changed, but I'm
unconvinced that returning two numbers instead of one does anything
except push the problem elsewhere.
* A new commit is added to make <ispowerof2.h> log_2_bits work on 64
bit ints on all platforms. I tested this inside a 32 bit mock.
* Add more debugging, and in particular print the seed.
* Use Python to count bits instead of scary shell script.
* When comparing subsets in the tests, make sure they contain a stuck
bit.
* Use '**' for exponentiation consistently.
* Various other comments / typos / etc fixed and some improvements to
the man page.
* Retest.
Now I must get back to doing real work!
Rich.