random.py 314 Bytes
Newer Older
Theo Steininger's avatar
Theo Steininger committed
1
2
3
4
# -*- coding: utf-8 -*-

import numpy as np

5
6
from .config import configuration as gc,\
                    dependency_injector as gdi
Theo Steininger's avatar
Theo Steininger committed
7
8
9
10
11
12
13
14
15

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)