|
|
#1 |
|
Frenzied Member
Join Date: Apr 01
Location: Borneo Rainforest Habits: Scratching
Posts: 1,452
![]() ![]() ![]() ![]() |
Random numbers in Gaussian distribution
This code generates random numbers in a Gaussian distribution, rather than uniformly (although there is a uniform pseudo-random number generator in there...).
The usual RNG, picking integers in the range 0 to 10, would tend to pick each of them an equal number of times, as the number of picks gets very large. This RNG preferentially picks numbers in the centre of the distribution, according to the specified mean (centre) and standard deviation (width). It is in an Excel sheet for convenience of viewing - simply enter a mean and sd in the yellow boxes and push "Go". There are further instructions on the sheet itself. The code is translated into VBA from Numerical Recipes in C, which are incredibly useful maths programming books. They can even be downloaded at http://www.nr.com. The translation to .Net should be pretty straightforward, hence I haven't worried about it. Have fun zaza |
|
|
|
|
|
#2 |
|
Dream Theater Fan
Join Date: Aug 02
Location: #!/bin/bash
Posts: 5,639
![]() ![]() ![]() ![]() ![]() ![]() |
Re: Random numbers in Gaussian distribution
If you want to quickly approximate gaussian distribution you can always just take the average of 2 random numbers. (or the more randoms you take the average from the tighter the bell curve gets).
__________________
RPNSolve version 1.1.3 (Free commandline math parser) Go on, it's for charity.Registered Linux user number 0x7468A. My Flickr ![]() Of course you're free to go // Go and tell the world my story // Tell them about my brother // Tell them about me // The Count of Tuscany |
|
|
|
![]() |
|
||||||
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|