"""Small deterministic interleaving experiment; noncryptographic PRNG only."""
import json,platform,random
def interleaved(extra,separate):
 a=random.Random(37);b=random.Random(91) if separate else a
 first=a.random();b.random()
 if extra:b.random()
 return [first,a.random(),a.random()]
def demo():
 shared=[interleaved(e,False) for e in [False,True]];independent=[interleaved(e,True) for e in [False,True]]
 assert shared[0][0]==shared[1][0] and shared[0][1:]!=shared[1][1:] and independent[0]==independent[1]
 r=random.Random(37);r.random();state=r.getstate();first=[r.random() for _ in range(3)];r.setstate(state);replay=[r.random() for _ in range(3)];assert first==replay
 same_seed_a=random.Random(37);same_seed_b=random.Random(37);identical=[same_seed_a.random() for _ in range(3)]==[same_seed_b.random() for _ in range(3)];assert identical
 return {'runtime':platform.python_version(),'shared_without_and_with_extra_B_draw':shared,'separate_without_and_with_extra_B_draw':independent,'getstate_setstate_replay':{'first':first,'replay':replay},'separate_same_seed_identical':identical,'scope':'State isolation is not statistical independence/security or whole-model/GPU determinism. Single-thread observed version only; no full internal state published.'}
if __name__=='__main__':print(json.dumps(demo(),ensure_ascii=True,indent=2))
