Skip to content

Commit

Permalink
Merge pull request #810 from dirac-institute/rng_seed
Browse files Browse the repository at this point in the history
Seed the random number generator with urandom
  • Loading branch information
mschwamb authored Feb 6, 2024
2 parents 837e9c9 + 87e395e commit a25d1b1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/sorcha/utilities/sorchaArguments.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np
from dataclasses import dataclass
import time
from os import path
from os import path, urandom
import logging

from sorcha.modules.PPModuleRNG import PerModuleRNG
Expand Down Expand Up @@ -78,7 +78,7 @@ def read_from_dict(self, args):
# WARNING: Take care if manually setting the seed. Re-using seeds between
# simulations may result in hard-to-detect correlations in simulation
# outputs.
seed = args.get("seed", int(time.time()))
seed = args.get("seed", int.from_bytes(urandom(4), "big"))
self._rngs = PerModuleRNG(seed, self.pplogger)

def validate_arguments(self):
Expand Down

0 comments on commit a25d1b1

Please sign in to comment.