numpy.random common functions

numpy.random commonly used functions

Random number generation function parameter has two components: low / high and the size / length / shape

Simple random number generation

Function name Katachisan effect
rand (D 0, d 1, d n) [0,1) uniformly distributed prescribed shape
random ([size]) [0,1) evenly distributed continuously, a prescribed shape
randn (D 0, d 1, d n) Standard normal distribution, a predetermined shape
Randine (low[, high, size, dtype]) Discrete uniform distribution, on the specified lower limit / shape

Notes: [size]: int or tuple of ints; [] denotes optional parameters; default distribution is uniform, except at the end of a normal n

Distribution function

In accordance with the low, high specific distribution pattern generated

  • beta(a, b[, size])
  • binomial (n, p [, size]) binomial
  • exponential ([scale, size]) exponential distribution
  • f(dfnum, dfden[, size]) F分布
  • gamma(shape[, scale, size]) Gamma分布
  • geometric (p [, size]) Geometric Distribution
  • normal ([loc, scale, size]) normal
  • uniform ([low, high, size]) discrete uniform distribution

See detailed official document:
https://docs.scipy.org/doc/numpy/reference/routines.random.html?highlight=random#module-numpy.random

Guess you like

Origin blog.csdn.net/houhuipeng/article/details/91047607