SPB Git

spb/wp27_uqo

Public
961 B · 21 lines python
1"""Seed management: one master seed -> named independent streams (common random numbers).23Streams: 'fundamentals' (dividend path), 'news', 'slots', 'assign', 'llm_assign', 'agents' (one4sub-stream per agent id), 'activation', 'tiebreak'. A treatment that changes only `llm_share` leaves5every other stream's draws untouched, so matched pairs share fundamentals, news and endowments."""6from __future__ import annotations78import numpy as np910STREAMS = ("fundamentals", "news", "slots", "assign", "llm_assign", "activation", "tiebreak", "mock_llm", "shuffle")111213def make_streams(seed: int) -> dict[str, np.random.Generator]:14    ss = np.random.SeedSequence(seed)15    children = ss.spawn(len(STREAMS))16    return {name: np.random.Generator(np.random.PCG64(c)) for name, c in zip(STREAMS, children)}171819def agent_rng(seed: int, agent_id: int) -> np.random.Generator:20    return np.random.Generator(np.random.PCG64(np.random.SeedSequence([seed, 7_919, agent_id])))21
Files · b6c1d09b402a43e723c06ff0c9a6073a51ea3fa7
Menu

Theme