如何偏置一个随机数发生器
我使用随stl c ++提供的随机数生成器。我们如何偏好它,以便产生更小的随机数,其概率大于更大的随机数。
i am using the random number generator provided with stl c++. how do we bias it so that it produces smaller random numbers with a greater probability than larger random numbers.
case你可能想要一个概率分布。你可以从一个均匀的随机数生成器生成任何分布,问题只是它应该是什么样子。 拒绝抽样是生成难以描述的分布的常见方法,但在您的情况下,更简单的可能就足够了。
Well, in this case you probably would like a certain probability distribution. You can generate any distribution from a uniform random number generator, the question is only how it should look like. Rejection sampling is a common way of generating distributions that are hard to describe otherwise, but in your case something simpler might suffice.
您可以查看这篇文章用于许多常见的分布函数。 Chi , Chi-Square 和指数看起来很不错。
You can take a look at this article for many common distribution functions. Chi, Chi-Square and Exponential look like good candidates.