uniform_draws

std.seq.uniform_draws · Level L4

One uniform number in [0, 1) for each element of x, from the Wichmann–Hill generator started at state: a Scan of wichmann_hill_step, then the fractional part of s₁/m₁ + s₂/m₂ + s₃/m₃. The same state always gives the same numbers, on every backend. Its period is about 7·10¹²; it is not for cryptography.

u = (s₁/30269 + s₂/30307 + s₃/30323) mod 1

Signature

uniform_draws(state: i64[3], x: f64[n]) → f64[n]

Structure

The function as NOVA stores it: one box per input, operation and output, and arrows that carry values. A double border marks another library function this one runs — called once, or by Scan once per element; select it to open that function.

statei64[3]xf64[n]Scan·wichmann_hill_stepstates[30269.0, 30307.0, 30323.0]DividepartsReduceSumtotal1.0Moduuf64[n]
  • input
  • operation
  • constant
  • call
  • output

Verification

  • Signature proven by NOVA’s shape solver, for every size.
  • Equal to the reference Wichmann–Hill in exact fractions in exact rational arithmetic, on all 40 test cases.
  • All 110 float64 results inside the running error bound; the closest uses 54% of it.
  • Interpreter and NumPy backend return bit-identical results.
Accuracy in detail
correctly rounded (the float64 nearest the exact value)
35%
bit-equal to the NumPy formula in float64
35%
largest error, in units in the last place
133

Large ulp counts appear where a result is tiny next to the numbers it is computed from (after cancellation, for example), so one unit in the last place is tiny too; the absolute error is still inside the bound. Results within their own error of zero are not counted.

Identity

sha256:2702ff141b6cdd00d6b13858cd2c2acc974f47befb732d0764be57c362000a87

The semantic hash of the graph. It changes when the program changes, and never when only its documentation does.