当前位置: 动力学知识库 > 问答 > 编程问答 >

python - Probability based randomzation of 2d Numpy array

问题描述:

How would I create a random 2D numpy matrix such that values closer to zero are given high probability?

网友答案:

The Gausssian distribution is highest around 0:

print numpy.random.randn(3,4)

Out:

[[-0.06694895 -0.4634386  -1.5856743  -0.3946314 ]
 [-1.43080135  0.24923625  0.74692133 -1.73131258]
 [ 0.48610534  0.66854414  1.19446753 -0.4729655 ]]
分享给朋友:
您可能感兴趣的文章:
随机阅读: