NumPy Pseudorandom Number Generation: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 8: Line 8:
</syntaxhighlight>
</syntaxhighlight>
<font size=-2>
<font size=-2>
  array([-0.31574999, -0.22620981,  0.78084923, -0.08299547,  0.02537403,
  array([-0.31574999, -0.22620981,  0.78084923, -0.08299547,  0.02537403, -0.39786547,  0.69732466, -1.76220064,  0.26101635, -0.32073839])
        -0.39786547,  0.69732466, -1.76220064,  0.26101635, -0.32073839])
</font>
</font>


Line 22: Line 21:
         [-1.25755550e+00,  2.60187554e-01,  5.62396877e-01]])
         [-1.25755550e+00,  2.60187554e-01,  5.62396877e-01]])
</font>
</font>
<font color=darkkhaki>TODO: https://learning.oreilly.com/library/view/python-for-data/9781098104023/ch04.html#:-:text=These%20random%20numbers%20are%20not%20truly%20random</font>.

Latest revision as of 17:39, 21 May 2024

Internal

Overview

The numpy.random module supplements the built-in Python random module with functions for efficiently generating whole arrays of sample values from many kinds of probability distributions.

np.random.standard_normal(10)

array([-0.31574999, -0.22620981,  0.78084923, -0.08299547,  0.02537403, -0.39786547,  0.69732466, -1.76220064,  0.26101635, -0.32073839])

np.random.standard_normal(size=(5, 3))

array([[ 6.26367775e-01, -7.97741988e-01,  1.53270456e-01],
       [ 1.66227193e+00, -1.16015757e-03,  9.65301493e-01],
       [-8.90605112e-01,  8.53983237e-01, -4.24828642e-01],
       [-4.60834281e-01, -1.36535277e+00,  1.89016088e+00],
       [-1.25755550e+00,  2.60187554e-01,  5.62396877e-01]])

TODO: https://learning.oreilly.com/library/view/python-for-data/9781098104023/ch04.html#:-:text=These%20random%20numbers%20are%20not%20truly%20random.