Skip to content

Property tests repeat their sample: the seeded LCG cycles #38

Open

Description

@PhilflowIO

Symptom

The property tests in test/seriesMoveProperty.test.ts (4 generators) and test/recurOrder.test.ts draw from seed = (seed * 1103515245 + 12345) % 2147483648 in doubles. The product exceeds 2^53, loses its low bits, and the sequence falls into short cycles. Seed 37 repeats after 852 draws on a cycle of 220; seed 31 (recurOrder) after 11,235 draws. Raising SERIES_PROPERTY_RUNS past the cycle repeats the same samples instead of widening the sample, and some seeds give far fewer distinct cases than the run count suggests.

Fix

Draw from an exact 32-bit generator (for example mulberry32 with Math.imul, as test/expandFrom.test.ts does since #37), keeping SERIES_PROPERTY_SEED replayable.

Acceptance

  • Every property generator yields at least RUNS × draws-per-run distinct values for the default seeds and seeds 1-8.
  • The suites still pass at the default and at 5,000 runs.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions