Quick question on Glulx randomness

Like the Z-machine, Glulx has a random-number generator that can be set to “nondeterministic” (as random as possible) or “deterministic” (set a given seed, get a predictable list of random numbers out).

I have not made an attempt to specify the algorithm for deterministic mode, so the behavior has varied across platforms and between interpreters. (Glulxe uses the platform srandom(), but srand() on Windows; Git uses srand() everywhere; Quixe uses something I hand-coded.)

This has started to be a problem in testing. It’s nice to be able to run a test suite on many platforms, and at the moment, a test suite that includes randomness will produce different output on Mac vs Windows vs web-browser.

Options that I see:

  • Ignore the problem.

  • Update Glulxe to use the same deterministic algorithm on every platform, but don’t require it in the VM spec.

  • Update Glulxe and Git to use the same deterministic algorithm on every platform, but don’t require it in the VM spec.

  • Put the algorithm in the spec, and then update all interpreters.

(The algorithm would be the simple Mersenne twister which already exists in the Glulxe source code. I implemented it for MacOS Classic; I don’t think it’s been used since then.)

Thoughts? This is not urgent; we can toss it around a little and then allow the interpreters to update on their own schedule. I don’t want to leave it up in the air for months and months, though.

I’d say go with “Put the algorithm in the spec, and then update all interpreters.”. It’s probably best for the standardisation of interpreters.

Ditto. Inform 7 (the authoring tool) is supposed to be platform-agnostic, but since it has the Skein & Transcript built-in, it cannot fulfill that promise unless the Glulx spec includes the deterministic random # generator.

Why not include the algorithm in the test source code?

Which test source code? I didn’t break out cases, but we could think about compiler testing, interpreter testing, and game testing here – they’re all relevant.