osmose.engine_cs.philox

The C# engine’s random numbers, reproduced in Python (spec section 5.3, plan task 0.5).

The C# engine draws every number from Philox4x64-10, which is also what numpy.random.Philox implements, so Python can compute any word the engine draws. Later tests use this to feed the Numba oracle kernel the same permutations the C# kernel gets (spec section 10.1). Pure NumPy; importing it never loads the CLR.

The NumPy call. numpy.random.Philox increments its 256-bit counter before generating a block, so the block for counter c comes from Philox(counter=c - 1, key=k) followed by random_raw(4). Counter and key are little-endian multi-word integers: c0 and K0 are the least significant words.

Functions

block(key, c0, c1, c2, c3)

The four 64-bit words of the block for counter (c0, c1, c2, c3).

run_key(seed[, scheme])

The engine's key for a run (PhiloxKey.ForRun): (SplitMix64(seed), DOMAIN ^ scheme).

splitmix64(x)

Vigna's SplitMix64 finaliser (Philox.SplitMix64 in C#).

step_word(step, substep)

The counter's third word: (step << 16) | substep (PhiloxStream.StepWord).