开发者

Algorithm for generating normally distributed random values in C? [duplicate]

开发者 https://www.devze.com 2023-01-19 20:57 出处:网络
This question already has answers here: Closed 12 years ago. Possible Duplicate: Converting a Uniform Distribution to a Normal Distribution
This question already has answers here: Closed 12 years ago.

Possible Duplicate:

Converting a Uniform Distribution to a Normal Distribution

Hello.

I'd like to know of any algorithm implemented in C which can take a random value between 0 and 1, the mean and standard deviation and then return a normally distributed result.

I have too little brainpower to figure this o开发者_JAVA百科ut for myself right now.

I can't find anything useful on the internet.

Thank you.


Box-Muller is the transform you need.


There's already been the suggestion for Box Muller, but a computationally simpler approach is simply to take advantage of the central-limit theorem; add enough independent random variables together, and the result will approximate a normal distribution.

0

精彩评论

暂无评论...
验证码 换一张
取 消