Guaranteed way to initialize determinized random port Shiro Kawai (15 May 2026 12:22 UTC)
Re: Guaranteed way to initialize determinized random port John Cowan (15 May 2026 19:52 UTC)
Re: Guaranteed way to initialize determinized random port Shiro Kawai (15 May 2026 20:06 UTC)
Re: Guaranteed way to initialize determinized random port Wolfgang Corcoran-Mathe (15 May 2026 22:57 UTC)

Re: Guaranteed way to initialize determinized random port John Cowan 15 May 2026 19:51 UTC

This was discussed earlier.  The idea is that you get a port from the
library and ask it for its state, the size of which is the size needed
to correctly initialize a second port, which is the real port.

On Fri, May 15, 2026 at 8:22 AM Shiro Kawai <xxxxxx@gmail.com> wrote:
>
> I can pass an arbitrary bytevector or binary input port as an initializer to create a determinized random port, but make-random-port may raise an error if the initializer lacks sufficient data, correct?
>
> Interpreting it strictly, the user cannot create a determinized random port with some predetermined initializer because the minimum required size for that data is unknown.
>
> It is reasonable not to specify the initializer's details, as this depends on the internal algorithm.  But sometimes it is handy for the user to provide a hardcoded "seed" value.  For example, a randomized test wants to guarantee that each run uses the same sequences for reproducibility, so the user wants to anchor the initial state.  The actual sequence can vary among implementations; however, it must remain the same when run on the same implementation and version.
>
> Without knowing the minimum required size, the test needs to save the result of the random-port-state the first time it runs on a particular implementation/version and use it for subsequent runs.  Writing such test code is cumbersome, at least.  (E.g. suppose you're bisecting to find a bad commit---you check out a particular revision and build from a clean state.  How do you give the same initializer for each check?)
>
> If we know the minimum requirement---say, n bytes of bytevector is guaranteed not to throw an initialization error---a fixed seed is given in the test code.  The minimum doesn't need to cover the entire possible state space.
>
> What do you think?
>
> --shiro