Python生成高斯随机数(标准正态分布随机数)

代码np.random.normal(loc=0.0, scale=1.0, size=None)

import random
import numpy as np
x=[]
for i in range(100):
    a=np.random.normal(loc=0.0, scale=1.0, size=None)
    x.append(a)
print(x)

对应的参数:

loc:均值
scale:标准差
size:输出形式/维度

输出示例:

[-0.27253811517094106, 0.5609684144467797, 0.334971283784437, -0.1822778169662192, 1.2681223959150012, 1.2328794595153236, -0.3123326943041807, 0.1509173477179033, 0.26710212597423183, -0.7132879236969326, 1.4473196811471687, 0.6774980094513453, -1.6030403311814199, 0.8648297512590672, 0.9541298220551128, 0.19975976654455535, 0.39949933286608913, 0.6426455545555159, -0.7099122674171993, -1.0921728091444043, -1.1605676669247265, -0.5213446266079783, -1.0729374918398586, -0.42508116246866895, -2.1225656950542566, -0.018079339358717344, -0.3967882207036764, -0.11615681742789798, 0.3959781462653823, -0.4422546552470426, -0.45658310669718555, -0.41665303539298026, 0.4106375960351183, 0.7946145527667485, 0.40155698536767886, -0.43160558716163333, -0.8187458265642145, 0.4733591470772272, -0.512925141874276, 0.8942315459113407, -0.18699899393413216, -1.920234569791857, -1.3199069899730669, -0.12743885240423444, -0.06967172106188232, -0.2246066523578624, 0.03641342849134644, -0.053470943398817916, 1.1744274015249043, -0.9435170352866044, -0.11353662588737247, -1.8692171469851853, -0.476445232927885, -0.2708492260528827, -0.11651492597485748, 0.02964131159954893, 0.25578306216680463, 1.2023111385087462, 1.122831951168718, -0.7308969156174356, 0.3811122809887224, 0.335473588586483, -1.1167554592019655, -1.1514348899396745, 0.7231538350180756, 0.9542725371333689, -1.831688480671393, 0.09182126579647497, 0.1739749571732342, 0.620176859551349, 0.6958403843497568, -1.090884581324445, 0.7600870398395901, -1.030191097275002, -0.7290470403280889, 0.06036403155582693, -0.2664700890089135, -0.3855530279087296, 0.6286878598349667, -0.8480215298426873, -1.180616696418588, -1.005016623815381, 1.042715871847052, -0.38178882402768816, 0.31263870120857723, 2.3554699344809262, 0.36228557870792766, -0.7734401711015115, 1.1189369662279494, -0.38014393103580185, -0.8177391087304116, -0.793471802195223, 0.6238413958778506, 1.0469161789217385, -1.4572003375874896, 1.1824881239007394, 0.3499870978487047, 0.06894617572574108, -0.6243622120335651, 0.8697811358505547]

更多相关推荐

python生成正态分布随机数

        使用python基础库random生成具备正态分布特征的随机数,并对生成的随机数的统计性质进...

继续阅读

python生成标准正态分布随机数_P...

在使用PyTorch做实验时经常会用到生成随机数Tensor的方法,比如:torch.rand()torch.randn()to...

继续阅读

python如何生成正态分布随机数_P...

主要涉及python的random()内置模块和numpy的np.random()函数,在平时学习过程中很容易弄混淆,...

继续阅读

python生成正态分布随机数_pytho...

版权声明:本文为博主原创文章,遵循CC4.0BY-SA版权协议,转载请附上原文出处链接和本声明。股...

继续阅读

服从正态分布随机数的生成

服从正态分布随机数的生成生成单变量正态分布随机数Box-Muller算法Accept/Reject算法(接受/拒...

继续阅读

用Python生成正态分布随机数组

几个函数用来生成、存储、保留生态分布随机数组

继续阅读

python随机生成正态分布_python...

这篇文章主要介绍了Python生成随机数的方法。如果你对在Python生成随机数与random模块中最常用...

继续阅读

python生成正态分布随机整数_pyt...

以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,...

继续阅读

python产生正态分布随机数_pytho...

Helponbuilt-infunctionrandint:randint(...)methodofnumpy.random.mtrand.RandomStateinstanc...

继续阅读

python生成100以内随机数_用Pyth...

ThecodeissupposedtobeindentedinPythonbutitisjustwhenItypedinStackOverflowIdidn'treallykn...

继续阅读