random.py 320 Bytes
Newer Older
Theo Steininger's avatar
Theo Steininger committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 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)