Introduce env var OAI_RNGSEED

can be used to set a random number generator (RNG) seed uniformly from
command line
This commit is contained in:
Robert Schmidt
2023-06-17 09:45:52 +02:00
parent 49703eee7b
commit 710bfdbf04
2 changed files with 3 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ OAI uses/supports a number of environment variables, documented in the following
- `NVRAM_DIR`: directory to read/write NVRAM data in (5G) `nvram` tool; if not defined, will use `PWD` (working directory)
- `OAI_CONFIGMODULE`: can be used to pass the configuration file instead of `-O`
- `OAI_GDBSTACKS`: if defined when hitting an assertion (`DevAssert()`, `AssertFatal()`, ...), OAI will load `gdb` and provide a backtrace for every thread
- `OAI_RNGSEED`: overwrites any seed for random number generators (RNG) in simulators
- `OAI_THREADPOOLMEASUREMENTS`: path to a file to store thread pool debugging information, see the [thread pool documentation](..common/utils/threadPool/thread-pool.md)
- `OPENAIR_DIR`: should point to the root directory of OpenAirInterface; some code relies on this to get a filename, e.g., BLER curves for L2sim channel emulation
- `RFSIMULATOR`: the RFsimulator's work mode, can be either `server` (for server mode) or a valid IP address (for client mode)

View File

@@ -55,6 +55,8 @@ void randominit(unsigned long seed_init)
unsigned long seed = seed_init;
if (seed_init == 0)
fill_random(&seed, sizeof(seed));
if (getenv("OAI_RNGSEED"))
seed = atoi(getenv("OAI_RNGSEED"));
printf("Initializing random number generator, seed %lu\n", seed);
// initialize uniformrandom RNG