Design and validation

Tandem is a random number generator built to be fast on CPUs and GPUs alike: Two-half Asymmetric Nonlinear Duplex with Evolving Multipliers. The specification defines the algorithms, stream order, draw mappings, and test vectors.

  • Eight 32-bit words, using 32x32→64 multiplication, xor, rotate, and add.
  • A hidden half runs a bijective clock and receives feedback from the new exposed half. The exposed half is a Philox-shaped Feistel whose multipliers and masks come from the hidden half.
  • The stream is cut into chunks of K steps. A keyed seeding function starts every chunk, so splitting and forking cost one seeding per pair of children. Random access adds at most K steps after seeding.
  • Chunks come in groups of eight, and the stream is a sequence of 128-byte rows: the eight 16-byte blocks of a group at one step. On a GPU each work-item owns one chunk and eight adjacent work-items write one contiguous row per step, direct 16-byte stores, no shared memory. On a CPU the eight chunks step together, with one eight-lane vector per state word.
  • A bit-aligned stream law. Scalar components stay inside 128-bit blocks. Complex draws compose two real draws. Fills and scalar loops agree on every supported backend.
  • All 18 PureRNGs result types: Bool, 8–128-bit integers, Float16/32/64, their complex types, and Char. Device fills exclude 128-bit integers. Metal also excludes Float64 and ComplexF64. Reactant supports Bool, 8–64-bit integers, and Float16/32/64.
  • The transport form of a generator is its 128-bit key plus a 64-bit bit position.

Validation evidence

The validation evidence contains logs, case matrices, protocols, input hashes, frozen reproduction scripts, and flagged results from PractRand, BigCrush, HWD, gjrand, and reduced-round tests.

The three archives total 5.42 MiB. Verify downloads against SHA256SUMS.

CI runs on pushes to main, version tags, and pull requests. Coverage reports the CPU package tests. GPU validation and optional integration suites run separately.