https://docs.scipy.org/doc/numpy/reference/routines.random.html
一下方法都要加np.random.前缀
注意生成的对象没有维度.既.shape属性,第二个数字是空.要用reshape来将它转换为多维度,这样才能像矩阵那样操作.

1.简单随机数据

name describe
rand(d0, d1, …, dn) 返回随机分布,d是维度的意思,既设置0维度数量,1维度数量
randn(d0, d1, …, dn) 返回正态分布
randint(low[, high, size, dtype]) 返回一个范围在 low (包含) 到 high (不包含)的整数.
random_integers(low[, high, size]) Random integers of type np.int between low and high, inclusive.
random_sample([size]) Return random floats in the half-open interval [0.0, 1.0).
random([size]) Return random floats in the half-open interval [0.0, 1.0).
ranf([size]) Return random floats in the half-open interval [0.0, 1.0).
sample([size]) Return random floats in the half-open interval [0.0, 1.0).
choice(a[, size, replace, p]) Generates a random sample from a given 1-D array
bytes(length) Return random bytes.

2.生成随机分布

name describe
beta(a, b[, size]) Draw samples from a Beta distribution.
binomial(n, p[, size]) Draw samples from a binomial distribution.
chisquare(df[, size]) Draw samples from a chi-square distribution.
dirichlet(alpha[, size]) Draw samples from the Dirichlet distribution.
exponential([scale, size]) Draw samples from an exponential distribution.
f(dfnum, dfden[, size]) Draw samples from an F distribution.
gamma(shape[, scale, size]) Draw samples from a Gamma distribution.
geometric(p[, size]) Draw samples from the geometric distribution.
gumbel([loc, scale, size]) Draw samples from a Gumbel distribution.
hypergeometric(ngood, nbad, nsample[, size]) Draw samples from a Hypergeometric distribution.
laplace([loc, scale, size]) Draw samples from the Laplace or double exponential distribution with specified logistic([loc, scale, size]) Draw samples from a logistic distribution.
lognormal([mean, sigma, size]) Draw samples from a log-normal distribution.
logseries(p[, size]) Draw samples from a logarithmic series distribution.
multinomial(n, pvals[, size]) Draw samples from a multinomial distribution.
multivariate_normal(mean, cov[, size]) Draw random samples from a multivariate normal distribution.
negative_binomial(n, p[, size]) Draw samples from a negative binomial distribution.
noncentral_chisquare(df, nonc[, size]) Draw samples from a noncentral chi-square distribution.
noncentral_f(dfnum, dfden, nonc[, size]) Draw samples from the noncentral F distribution.
normal([loc, scale, size]) Draw random samples from a normal (Gaussian) distribution.
pareto(a[, size]) Draw samples from a Pareto II or Lomax distribution with specified shape.
poisson([lam, size]) Draw samples from a Poisson distribution.
power(a[, size]) Draws samples in [0, 1] from a power distribution with positive exponent a - 1.
rayleigh([scale, size]) Draw samples from a Rayleigh distribution.
standard_cauchy([size]) Draw samples from a standard Cauchy distribution with mode = 0.
standard_exponential([size]) Draw samples from the standard exponential distribution.
standard_gamma(shape[, size]) Draw samples from a standard Gamma distribution.
standard_normal([size]) Draw samples from a standard Normal distribution (mean=0, stdev=1).
standard_t(df[, size]) Draw samples from a standard Student’s t distribution with df degrees of freedom.
triangular(left, mode, right[, size]) Draw samples from the triangular distribution over the interval [left, right].
uniform([low, high, size]) Draw samples from a uniform distribution.
vonmises(mu, kappa[, size]) Draw samples from a von Mises distribution.
wald(mean, scale[, size]) Draw samples from a Wald, or inverse Gaussian, distribution.
weibull(a[, size]) Draw samples from a Weibull distribution.
zipf(a[, size]) Draw samples from a Zipf distribution.

3.重排

name describe
shuffle(x) Modify a sequence in-place by shuffling its contents.
permutation(x) Randomly permute a sequence, or return a permuted range.

numpy random 模块相关推荐

  1. python自定义随机数_python:numpy.random模块生成随机数

    简介 所谓生成随机数,即按照某种概率分布,从给定的区间内随机选取一个数.常用的分布有:均匀分布(uniform distribution),正态分布(normal distribution),泊松分布 ...

  2. numpy.random模块常用函数

    在Numpy库中,常用使用np.random.rand().np.random.randn()和np.random.randint()随机函数. 1. np.random.randn()函数 作用:返 ...

  3. numpy.random 模块中文文档学习笔记

    1 numpy.random.randint() 整数随机,指定上下界,左闭右开 np.random.randint(1, size=10) >>> array([0, 0, 0, ...

  4. np.randon模块,numpy.random模块各函数功能详解,分类描述各个函数功能,生成随机数

    因为网上很多文章都是在依次列举各个函数的功能,并没有做分类,所以记忆上还有使用上都不方便. 本文旨在将功能相似的函数放在一起,以及对它们进行辨析和区分,便于精准地调用.未完待续 最权威的参考来源:Ra ...

  5. python numpy.random模块中提供啦大量的随机数相关的函数

    1. numpy中产生随机数的方法 1)rand() 产生[0,1]的浮点随机数,括号里面的参数可以指定产生数组的形状 2)randn() 产生标准正太分布随机数,参数含义与random相同 3)ra ...

  6. numpy.random 模块- 随机数

    numpy中有一些常用的用来产生随机数的函数. 1. rand(d0, d1, -, dn)的随机样本位于[0, 1)中. >>> np.random.rand(2,2) array ...

  7. Python中的random模块

    Python中的random模块用于随机数生成,对几个random模块中的函数进行简单介绍.如下: random.random() 用于生成一个0到1的随机浮点数.如: import random r ...

  8. python random 和numpy random_Python中numpy.random和random.random之间的区别

    我在Python中有一个大脚本. 我在其他人的代码中得到了启发,所以最终我在某些方面使用了numpy.random模块(例如,用于创建从二项式分布中获取的随机数数组),而在其他地方,我使用了模块ran ...

  9. numpy的random模块

    numpy的random模块 开区间是区间两边都不取等号 闭区间是两边都取等号 半开区间就是只取一边等号 翻译自官网的文档.转自http://www.mamicode.com/info-detail- ...

最新文章

  1. 李沐:用随机梯度下降来优化人生!
  2. 基于深度学习Superpoint 的Python图像全景拼接
  3. Deleted表用于存储DELETE和UPDATE语句所影响的行的复本
  4. bucket sort count sort
  5. 关于Python的学习和认知---刘浩
  6. aspnetcore源码学习(一)
  7. concurrently同时开启多个监听服务
  8. freemarker结合springMVC配置
  9. Linux指令:sed和awk指令
  10. Spring boot傻瓜教程(一):官方加强版,避开坑
  11. Oracle非重要文件恢复,redo、暂时文件、索引文件、password文件
  12. 没有Where条件下group by走索引
  13. 天刀找不到服务器,《天涯明月刀手游》好友服务器查看方法 怎么查看好友在哪个区...
  14. python 3d模型制作软件_最好用的9款3D建模软件
  15. 范德蒙行列式、克拉默法则、雅可比矩阵
  16. 关于 red bend
  17. Allegro导出pdf的两种方式
  18. 服务器temp文件夹文件都能清理吗,Temp文件夹是什么?Windows中Temp文件夹下内容可以随意删除吗?...
  19. c语言中的内存4区域模型(堆,栈,全局区,代码区)
  20. 数据挖掘学习日记1·有监督学习与无监督学习

热门文章

  1. Python使用颜色块覆盖视频中指定区域的内容
  2. 暴力测试也疯狂——论Python代码优化
  3. Python使用RSA+MD5实现数字签名
  4. udp协议服务器客户端流程图,UDP 协议通信服务器端客户端.doc
  5. background背景图片自适应_一侧定宽、一侧自适应,尽量多的方案实现?「前端剑指offer」...
  6. 计算机科学在各专业领域中的应用,计算机科学在各专业领域中的应用
  7. linux 行尾加字符串,linux – cat in expect脚本在字符串结尾添加新行
  8. C语言之文件读写探究(五):rewind、ftell、fseek(文件指针偏移)
  9. 龙族幻想服务器维护中怎么办,龙族幻想遇到无法连接服务器?两招教你轻松解决...
  10. jvm 参数_一文带你深入了解JVM内存模型与JVM参数详细配置