qiskit_qm_provider.random.box_muller_pair

box_muller_pair(rng: Random, mean: Sequence[FixedPoint | float], std: Sequence[FixedPoint | float], tables: BoxMullerTables | None = None) → tuple[list[FixedPoint], list[FixedPoint]][source][source]

Replay one rand_gauss_box_muller() call on the host.

Draws one Random.rand_fixed() per dimension, in order, exactly as the QUA macro does.

Parameters:
  • rng – Host generator mirroring the QUA Random passed to the macro.

  • mean – Per-dimension means; floats are quantized with FixedPoint(...) (round to nearest, as QUA’s declare(fixed, value=...)).

  • std – Per-dimension standard deviations, same length as mean.

  • tables – Lookup tables; defaults to BoxMullerTables.get() (512 entries).

Note

Fixed-point arithmetic wraps around on overflow, as on the controller, and FixedPointOverflowWarning is emitted when that happens. The replay stays exact, but the samples are rarely meaningful: keep std * r_max < 8 and |mean| + std * r_max < 8 (r_max is about 3.54 for 512 table entries).

Returns:

Tuple (z1, z2) of per-dimension samples as FixedPoint.

Raises:

ValueError – If mean and std have different lengths.