|
1 | | -#!/usr/bin/env python |
2 | 1 | # Copyright (c) 2017, Intel Corporation |
3 | 2 | # |
4 | 3 | # Redistribution and use in source and binary forms, with or without |
@@ -67,15 +66,39 @@ def seed(self, seed=None): |
67 | 66 | For full documentation refer to `numpy.random.seed`. |
68 | 67 |
|
69 | 68 | """ |
70 | | - return super().seed(seed=seed, brng="MT19937") |
| 69 | + return super().seed(seed=seed) |
71 | 70 |
|
72 | 71 | def get_state(self, legacy=True): |
73 | 72 | """ |
74 | 73 | get_state(legacy=True) |
75 | 74 |
|
76 | 75 | Get the internal state of the generator. |
77 | 76 |
|
78 | | - For full documentation refer to `numpy.random.get_state`. |
| 77 | + Parameters |
| 78 | + ---------- |
| 79 | + legacy : bool, optional |
| 80 | + Flag indicating to return a legacy tuple state. |
| 81 | +
|
| 82 | + Returns |
| 83 | + ------- |
| 84 | + out : {tuple(str, bytes), dict} |
| 85 | + The returned tuple has the following items: |
| 86 | +
|
| 87 | + 1. a string specifying the basic psedo-random number generation |
| 88 | + algorithm. It should always be `MT19937` for this class. |
| 89 | + 2. a bytes object holding content of Intel MKL's stream for the |
| 90 | + generator. |
| 91 | +
|
| 92 | + If `legacy` is False, a dictionary containing the state information is |
| 93 | + returned instead, with the following keys: |
| 94 | + 1. `bit_generator`: a string specifying the basic psedo-random |
| 95 | + number generation algorithm. It should always be `MT19937` for |
| 96 | + this class. |
| 97 | + 2. `state`: a dictionary guaranteed to contain the key |
| 98 | + `mkl_stream`, whose value is a bytes object holding content of |
| 99 | + Intel MKL's stream for the generator. |
| 100 | +
|
| 101 | + Compare with `numpy.random.get_state`. |
79 | 102 |
|
80 | 103 | *Compatibility Notice* |
81 | 104 | As this class uses MKL in the backend, the state format is NOT |
@@ -615,6 +638,9 @@ def __NPRandomState_ctor(): |
615 | 638 | get_state = _rand.get_state |
616 | 639 | set_state = _rand.set_state |
617 | 640 | random_sample = _rand.random_sample |
| 641 | +ranf = _rand.random_sample |
| 642 | +random = _rand.random_sample |
| 643 | +sample = _rand.random_sample |
618 | 644 | choice = _rand.choice |
619 | 645 | randint = _rand.randint |
620 | 646 | bytes = _rand.bytes |
|
0 commit comments