How can I distort the distribution of a set of random numbers?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-06 06:27:42
var random = Math.pow(Math.random(), 2);

Take a look at Poisson distribution, probably you can use it for your own purposes, essentially a poisson distribution is not deterministic, but it has a certain frequency of occurrence: wikipedia has a good introductory info about this: http://en.wikipedia.org/wiki/Poisson_distribution

Algorithm:

algorithm poisson random number (Knuth):
init:
     Let L ← e−λ, k ← 0 and p ← 1.
do:
     k ← k + 1.
     Generate uniform random number u in [0,1] and let p ← p × u.
while p > L.
return k − 1.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!