C#正态随机数随机数

由网友(ヌ酷还可爱)分享简介:我想创建一个函数,接受双平均值,双偏差,并返回一个随机数与正态分布。 I would like to create a function that accepts Double mean, Double deviation and returns a random number with a normal distr...

我想创建一个函数,接受双平均值双偏差,并返回一个随机数与正态分布。

I would like to create a function that accepts Double mean, Double deviation and returns a random number with a normal distribution.

例如:如果我通过在5.00的平均值2.00作为偏差的时候68%,我会得到3.00和7.00之间的数字。

Example: if I pass in 5.00 as the mean and 2.00 as the deviation, 68% of the time I will get a number between 3.00 and 7.00

我的统计是有点弱...。任何人有一个想法,我应该如何处理呢?我的实现将是C#2.0中,但随时只要数学函数是标准在您所选择的语言来回答。

My statistics is a little weak…. Anyone have an idea how I should approach this? My implementation will be C# 2.0 but feel free to answer in your language of choice as long as the math functions are standard.

我觉得this实际上可能是我所期待的。任何帮助转化这code?

I think this might actually be what I am looking for. Any help converting this to code?

在此先感谢您的帮助。

推荐答案

请参阅此$ C $的CProject文章:简单的随机数生成。在code是很短的,它产生的样本不统一,正常,指数分布。

See this CodeProject article: Simple Random Number Generation. The code is very short, and it generates samples from uniform, normal, and exponential distributions.

阅读全文

相关推荐

最新文章