To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
VBForums  

VB Wire News
Article :: Building Dynamic Systems with Expressions in .NET
How Is XML Like An Interface?
Understanding Covariance and Contravariance
Print VS 2010 Keyboard Shortcut References in Letter (8.5x11in) and A4 (210×297mm) Sizes
Updated Productivity Power Tools



Go Back   VBForums > VBForums CodeBank > CodeBank - Visual Basic 6 and earlier

Reply Post New Thread
 
Thread Tools Display Modes
Old Nov 21st, 2005, 03:59 PM   #1
zaza
Frenzied Member
 
zaza's Avatar
 
Join Date: Apr 01
Location: Borneo Rainforest Habits: Scratching
Posts: 1,452
zaza is a jewel in the rough (300+)zaza is a jewel in the rough (300+)zaza is a jewel in the rough (300+)zaza is a jewel in the rough (300+)
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
Attached Files
File Type: zip gaussnumzip.zip (58.7 KB, 1057 views)
zaza is offline   Reply With Quote
Old Apr 1st, 2006, 02:55 PM   #2
wossname
Dream Theater Fan
 
wossname's Avatar
 
Join Date: Aug 02
Location: #!/bin/bash
Posts: 5,639
wossname is a glorious beacon of light (400+)wossname is a glorious beacon of light (400+)wossname is a glorious beacon of light (400+)wossname is a glorious beacon of light (400+)wossname is a glorious beacon of light (400+)wossname is a glorious beacon of light (400+)
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
wossname is offline   Reply With Quote
Reply

Go Back   VBForums > VBForums CodeBank > CodeBank - Visual Basic 6 and earlier


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 07:55 PM.





Acceptable Use Policy

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.