From 2b433c4ac049283079b01df878f0151f50e16d39 Mon Sep 17 00:00:00 2001 From: Theo Steininger Date: Wed, 23 Aug 2017 14:19:34 +0200 Subject: [PATCH] added missing random.py --- d2o/random.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 d2o/random.py diff --git a/d2o/random.py b/d2o/random.py new file mode 100644 index 0000000..4300152 --- /dev/null +++ b/d2o/random.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- + +import numpy as np + +from d2o.config import configuration as gc,\ + dependency_injector as gdi + +MPI = gdi[gc['mpi_module']] +comm = gc['default_comm'] +rank = comm.rank + + +def seed(seed=None): + seed = rank if seed is None else np.uint32(seed) + rank + np.random.seed(seed) -- GitLab