25 lines
490 B
Python
25 lines
490 B
Python
|
import os
|
||
|
import numpy as np
|
||
|
|
||
|
|
||
|
def group_seed():
|
||
|
bd_env_var = os.getenv("BIRTHDAYS")
|
||
|
|
||
|
# If no birthdays are set, complain and exit
|
||
|
if not bd_env_var:
|
||
|
print("Environment variable BIRTHDAYS is missing")
|
||
|
exit(-1)
|
||
|
|
||
|
# convert birthdays to ints
|
||
|
birthdays = [int(bd) for bd in bd_env_var.split(",")]
|
||
|
|
||
|
# multiply them to get the group seed
|
||
|
seed = 1
|
||
|
for bd in birthdays:
|
||
|
seed *= bd
|
||
|
|
||
|
return seed
|
||
|
|
||
|
|
||
|
rng = np.random.default_rng(group_seed())
|