Skip to content

Seed the PRNG: --seed N, default random, printed for reproducibility - #7

Open
spinkham wants to merge 1 commit into
bubnikv:masterfrom
spinkham:feat/seed-flag
Open

Seed the PRNG: --seed N, default random, printed for reproducibility#7
spinkham wants to merge 1 commit into
bubnikv:masterfrom
spinkham:feat/seed-flag

Conversation

@spinkham

Copy link
Copy Markdown

rand() is never seeded anywhere in the tree, so it runs from C's default seed and every pathsim invocation produces bit-identical fading and noise — verified byte-identical output across separate process runs. Anyone running the simulator N times to gather fade-ensemble statistics (BER curves, modem robustness trials) gets one realization replayed N times, silently.

This adds a --seed N option:

  • default = a fresh std::random_device seed, so back-to-back runs are independent trials;
  • the seed used is always printed to stderr (stderr so stdout stays clean if a streaming mode ever lands), so any interesting run can be reproduced exactly with --seed.

Verified (on master + the <cstring> build fix from #6, needed to compile on modern GCC):

run1: pathsim: seed 1914797499 | run2: pathsim: seed 2041925530
unseeded runs differ            (was: byte-identical)
same --seed runs byte-identical (reproducibility preserved)

One commit, ~15 lines, no change to any DSP path — only when the shared PRNG is seeded.

🤖 Generated with Claude Code

…ility)

rand() was never seeded, so every pathsim invocation produced
bit-identical fading and noise (verified byte-identical across separate
process runs): N runs intended as independent Monte-Carlo trials replay
one realization N times, silently. Seed from std::random_device by
default, accept --seed N for exact reproduction, and print the seed used
to stderr (stderr so a future stdout streaming mode stays clean).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant