“np.random.normal” Réponses codées

Python aléatoire de la distribution normale

>>> mu, sigma = 0, 0.1 # mean and standard deviation
>>> s = np.random.normal(mu, sigma, 1000)
Difficult Dunlin

np.random.normal

import numpy as np
np.random.normal(loc=0.0, scale=1.0, size=None)  #Example below

mean, standard_deviation, samples = 23 ,0.8 ,1000

normal_samples = np.random.normal(loc=mean,scale=standard_deviation, size=samples)
'''Parameters
loc :float or array_like of floats
Mean (“centre”) of the distribution.

scale: float or array_like of floats
Standard deviation (spread or “width”) of the distribution. 
Must be non-negative.

size :int or tuple of ints, optional Output shape. 
If the given shape is, e.g., (m, n, k), 
then m * n * k samples are drawn. 
If size is None (default),
a single value is returned if loc and scale are both scalars.
Otherwise, np.broadcast(loc, scale).size samples are drawn.'''

'''Returns
outndarray or scalar
Drawn samples from the parameterized normal distribution.'''
Dangerous Dogfish

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code