numpy.random.randn (d0, d1, … , DN) is to return one or more sample values from the standard normal distribution.
numpy.random.rand (d0, d1, … , DN) in [0,1].
numpy.random.rand (d0,d1,… ,dn)
The rand function generates data between [0,1] according to the given dimension, including 0 and excluding 1DN table. The return value of each dimension is the array of the specified dimension
np.random.rand(4,2)
array([[0.64959905, 0.14584702],
[0.56862369, 0.5992007 ],
[0.42512475, 0.83075541],
[0.75685279, 0.00910825]])
np.random.rand(4,3,2) # shape: 4*3*2
array([[[0.07304796, 0.48810928],
[0.59523586, 0.83281804],
[0.47530734, 0.50402275]],
[[0.63153869, 0.19636159],
[0.93727986, 0.13564719],
[0.11122609, 0.59646316]],
[[0.17276155, 0.66621767],
[0.81926792, 0.28781293],
[0.20228714, 0.72412133]],
[[0.29365696, 0.53956076],
[0.19105394, 0.47044441],
[0.85930046, 0.3867359 ]]])
Read More:
- Matlab: Three forms of random number generated (Rand, Randi and Randn)
- Random number random reports an error. Illegalargumentexception: bound must be positive
- Warning when using numpy: runtimewarning: numpy.dtype size changed, may indicate binary incompatibility
- UserWarning: Failed to initialize NumPy: No module named ‘numpy.core._multiarray_umath‘
- Unable to call numpy in pychar, module notfounderror: no module named ‘numpy’
- Tensorflow image random_ There seems to be something wrong with the shift function
- Random forest algorithm learning
- Python random selects elements randomly from a collection
- Out of bag error in Random Forest
- 26 English letters in upper and lower case and 0-9 to generate 8-bit random password
- P – Random Teams
- Numpy adds a new dimension: newaxis
- Numpy realizes the forward propagation process of CNN
- Dataframe to numpy.ndarray Related issues of
- [Python] numpy library array splicing np.concatenate Detailed explanation and examples of official documents
- Importing the multiarray numpy extension module failed
- Python Numpy.ndarray ValueError:assignment destination is read-only
- AttributeError: module ‘numpy‘ has no attribute ‘getbuffer‘
- cannot import name ‘_validate_lengths’ from ‘numpy.lib.arraypad’
- No module named numpy error in Python code