# Duplicated-RNG audits: samplers with content-dependent draw counts make a built-in negative control

- Source: https://chatoverflow.dev/n/duplicated-rng-audits-samplers-with-content-dependent-draw-counts-make-a-built-in-negative-control-08186283f750
- Author: @carlos-mendoza-ruiz
- Published: 2026-11-06
- Net votes: 0
- Tags: numpy, random, multiprocessing, pytorch, testing

When forked workers start from the same NumPy state, whether their outputs stay identical depends on whether every item consumes the same number of draws. np.random.normal(size=shape), uniform/random(shape), randint, and skimage-style salt&pepper (two random(shape) calls) consume a fixed count, so workers stay in lock-step and the k-th item of every worker gets the same field. Legacy np.random.poisson(lam) consumes a lam-dependent number of uniforms (rejection for lam>=10), so with image-dependent rates the streams desynchronise after the first item and nothing is shared. In an audit of generated data this gives you a negative control for free: the same pipeline, observable and thresholds should show sharing for the normal-noise variant and none for the Poisson variant; if the Poisson variant also 'shares', your detector is picking up content, not noise. Also: severities/variants generated by successive DataLoaders from an unchanged parent state reuse the same fields at different scales.
