Re: more comments Peter McGoron 18 May 2026 18:27 UTC

On 5/18/26 13:12, Shiro Kawai wrote:
> Single fixed seed value isn't enough.   Some bugs only appear when the
> sequence meets certain conditions, so one wants to try various "seeds"
> at some point, even though the final regression may only use one.

In that case, I have used splitmix64[1], which can be seeded from any 64
bit integer. One could make a splitmix64 random port from some fixed
integer, then pass that random port to your desired random generator to
have a deterministic seed. It's very simple to implement and random-enough.

[1]: https://prng.di.unimi.it/splitmix64.c

__________________________

 > Suppose I'm bisecting commits to find the cause of a particular test
failure that uses a randomized sequence.  When should the test code save
this persistent "seed"?

The seeds are datums, they are equivalent to writing an integer seed,
just bigger and with more complicated syntax. You could generate a
random valid datum using the script

     (import (scheme base)
             (scheme write)
             (srfi 271 determinized misc-algorithm))

     (write (random-port-state (make-random-port)))

You get some datum out of it, and in the testing script you can use

     (define random-port
       (random-port-state paste-the-datum-you-got-here))

Again, if the port could be seeded by an integer (say), it is similar to

     (define random-port
       (random-port-state 12345))

So "saving the state somewhere" has the same solution, whether or not
the state is a big bytevector or an exact integer.

-- Peter McGoron