从 J 中的正态分布生成随机数

Generate a random number from normal distribution in J

在J编程中:我知道如何得到一个线性随机数。

? 5#10
1 3 3 4 7

但是如何从正态分布中获取随机数,例如N(0,1)?谢谢!

我认为您正在统计数据包中查找 normalrand

   load 'stats'
   normalrand 5
_0.514477 1.23645 _0.353373 _0.522193 1.23505

另见 stats/distribs addon

   load 'stats/distrib'
   rnorm 4
_0.486091 _0.339021 1.50653 0.19308
   10 2 rnorm 4    NB. from distribution N(10,2)
10.0588 11.0472 13.6208 8.78888