You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
:caption: Install mkl_random from conda-forge channel
@@ -17,11 +18,11 @@ Package :mod:`mkl_random` is available in conda ecosystem on "conda-forge", defa
17
18
$ conda install -c intel mkl_random
18
19
19
20
.. code-block:: bash
20
-
:caption: Install mkl_random from default
21
+
:caption: Install mkl_random from default channel main
21
22
22
23
$ conda install mkl_random
23
24
24
-
The package can also be installed via :code:`pip`, either from PyPI, or from
25
+
The package can also be installed via :code:`pip` package manager, either from central Python package index (PyPI) repository, or from index maintained by Intel(R):
25
26
26
27
.. code-block:: bash
27
28
:caption: Install mkl_random using pip from intel channel on Anaconda
@@ -38,13 +39,14 @@ The :mod:`mkl_random` is also distributed as part of `Intel(R) Distribution for
38
39
First steps
39
40
-----------
40
41
41
-
The :mod:`mkl_random` package was designed following :class:`numpy.random.RandomState` class to
42
-
make use of :mod:`mkl_random` easy for current uses of:mod:`numpy.random` module.
42
+
The :mod:`mkl_random` package has followed the design of :class:`numpy.random` package to
43
+
make :mod:`mkl_random` easy to use for those already familiar with the:mod:`numpy.random` module.
43
44
44
45
.. note::
45
-
Since the first release of `mkl_random`, NumPy introduced new classes :class:`numpy.random.Generator` and
46
+
Since the first release of :mod:`mkl_random`, NumPy introduced new classes :class:`numpy.random.Generator` and
46
47
:class:`numpy.random.BitGenerator`, while also retaining :class:`numpy.random.RandomState` for backwards
47
-
compatibility.
48
+
compatibility. :mod:`mkl_random`, at present, does not provide classes mirroring :class:`Generator` or
49
+
:class:`BitGenerators`.
48
50
49
51
The state of pseudo-random number generator is stored in :class:`mkl_random.RandomState` class,
50
52
so using :mod:`mkl_random` begins with creating an instance of this class:
@@ -55,7 +57,7 @@ so using :mod:`mkl_random` begins with creating an instance of this class:
55
57
import mkl_random
56
58
rs = mkl_random.RandomState(seed=1234)
57
59
58
-
Sampling from difference probability distribution is done by calling class methods on the constructed instance:
60
+
Sampling from difference probability distribution is done by calling the class methods on the constructed instance:
59
61
60
62
.. code-block:: python
61
63
:caption: Generate one million variates from standard continuous uniform distribution
@@ -75,22 +77,46 @@ Here is an example of estimating value of :math:`\pi` by using Monte-Carlo metho
:caption: Sample output after executing above script
94
96
95
97
$ python pi.py
96
-
Pi estimate: 3.14167732
98
+
Pi estimate: 3.14167732
99
+
100
+
101
+
Pseudo-random vs. non-deterministic generators
102
+
----------------------------------------------
103
+
104
+
.. _pseudorandom_vs_truerandom:
105
+
106
+
Stochastic computations often need to work with *independent* samples
107
+
from either the same probability distribution, or a set of probability
108
+
distributions of interest.
109
+
110
+
`True random generator <https://en.wikipedia.org/wiki/Hardware_random_number_generator>`_ relies on
111
+
laws of physics to provide those, leveraging dedicated hardware providing a source of entropy.
112
+
113
+
`Psuedo-random generator <https://en.wikipedia.org/wiki/Pseudorandom_number_generator>`_ is an algorithm that outputs a sequence that emulates true randomness.
114
+
The quality of emulation is tested statistically through a battery of test, e.g. `Diehard tests <https://en.wikipedia.org/wiki/Diehard_tests>`_.
115
+
These tests check if various statistical tests can separate the pseudo-random sequence from a true random one.
116
+
117
+
Pseudo-random generators usually have an internal state and require its initialization, also sometimes known as seeding.
118
+
States initialization algorithms take user provided _seed_ value, usually an integer or a finite seqeuence of integers, and scramble it
119
+
to populate the internal state of the pseudo-random generator.
120
+
121
+
The sequence from the pseudo-random generator, unlike from true random generator, is repeatable, provided the internal state can be
122
+
saved and restored, or initialized to the same state.
0 commit comments