Forums: » Register « |  Free Tools |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |

New Free Tools on Dev Shed!

#1
July 6th, 2004, 11:37 PM
 jax79sg
Contributing User

Join Date: Aug 2003
Posts: 33
Time spent in forums: 45 m 47 sec
Reputation Power: 11
Random numbers: Gaussian

Hi, i am trying to find a random generator based on normal/gaussian distribution. I looked at C's random generator and it indicates as a "pseudo random number generator". Pardon for my weak knowledge in statistics, but what is a pseudo random number gen?

Is there any sources where i can learn how to produce random numbers based on Gaussian distribution? Or the above generator is already producing gaussian distributed numbers?

#2
July 7th, 2004, 01:50 AM
 Scorpions4ever
Banned ;)

Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
Posts: 9,535
Time spent in forums: 2 Months 3 Days 5 h 32 m 8 sec
Reputation Power: 4106
Random number generators that are implemented by software are pseudo-random. Why? Because they have a period and can be persuaded to repeat a sequence. For example, you could have a generator like this:
x1 = (x0 * a) % b
where a and b are constants and x0 is the previous value generated from when you last called rand(). For the first time around, you may wish to seed x0 to a specific value (most people set it to the current time). Anyhow, this generator is pseudo random because after a while the values generated will begin to recycle. Also, if you start with the same starting x0 value, you will get the same "random" sequence each time. Also, if you know the algorithm and have enough values of consecutive rand() numbers generated by the algorithm, you should be able to predict (possibly by brute force) the sequence of numbers that will follow. For this reason, generators like this are pseudo random.

A true random number generator is implemented by hardware and resorts to some naturally occurring random process to trigger the number generation. For example, the decay of a radioactive element can be monitored by a geiger counter and used to output a stream of random bits. Another technique is to use faulty diodes which produce a lot of white noise and can be used to generate the bits. I remember reading somewhere that a computer in the 50s used the faulty diode technique, but programmers never used the hardware random generator because once the unit got too hot, the diodes would all always output a logical 1 .
__________________
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne

#3
July 7th, 2004, 06:50 AM
 mitakeet
I'm Baaaaaaack!

Join Date: Jul 2003
Location: Maryland
Posts: 5,538
Time spent in forums: 2 Weeks 4 Days 2 h 38 m 46 sec
Reputation Power: 243
Another reason for pseudo RNGs is to get reproduciblity. You could store the (potentially) billions of true random numbers to reproduce an experiment, or you could use a handy-dandy PRNG to create a stream of numbers. There are all kinds and qualities of PRNGs out there, you need to know what you are looking for before you choose one (or several). Amost all have slight (it is very slight, but that can effect sensitive experiments) biases, some are more 'random' than others (in any true random situation you expect to have random length runs of the same number as well as patterns, some PRNGs (particularly cryptographic) don't do that), others have short (relatively) repeat cycles, some are really really fast, etc. There is lots (and lots) of stuff on the web, spend a few hours and learn the background to PRNGs.
__________________

My blog, The Fount of Useless Information http://sol-biotech.com/wordpress/
Free code: http://sol-biotech.com/code/.
Secure Programming: http://sol-biotech.com/code/SecProgFAQ.html.
Performance Programming: http://sol-biotech.com/code/PerformanceProgramming.html.

It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it.
--Me, I just made it up

The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man.
--George Bernard Shaw

 Viewing: Dev Shed Forums > Programming Languages > C Programming > Random numbers: Gaussian

## Developer Shed Advertisers and Affiliates

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts vB code is On Smilies are On [IMG] code is On HTML code is Off
 View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox Forum Jump Please select one User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home -------------------- Programming Languages    PHP Development        PHP FAQs and Stickies    Perl Programming        Perl FAQs and Stickies    C Programming        C Programming FAQs and Stickies    Java Help        Java FAQs    Python Programming        Python Programming FAQs    Ruby Programming        Ruby Programming FAQs    Game Development        Game Development FAQs Programming Languages - More    ASP Programming        ASP Programming FAQs    .Net Development        .Net Development FAQs    Visual Basic Programming        Visual Basic Programming FAQs    Software Design        Software Design FAQs    ColdFusion Development        ColdFusion Development FAQs    Delphi Programming        Delphi Programming FAQs    Regex Programming        Regex Programming FAQs    XML Programming        XML Programming FAQs    Other Programming Languages        Other Programming Languages FAQs Web Design    HTML Programming        HTML Programming FAQs    JavaScript Development        JavaScript Development FAQs    CSS Help        CSS Help FAQs    Flash Help        Flash Help FAQs    Photoshop Help        Photoshop Help FAQs    Web Design Help        Web Design Help FAQs    Website Critiques        Website Critiques FAQs    Search Engine Optimization        Search Engine Optimization FAQs Mobile Programming    Mobile Programming        Mobile Programming FAQs    iPhone SDK Development        iPhone SDK Development FAQs    Android Development        Android Development FAQs    BlackBerry Development        BlackBerry Development FAQs Web Site Management    Business Help        Business Help FAQs    Development Software        Development Software FAQs    Scripts        Scripts FAQs Databases    Database Management        Database Management FAQs    DB2 Development        DB2 Development FAQs    MySQL Help        MySQL Help FAQs    PostgreSQL Help        PostgreSQL Help FAQs    Firebird SQL Development        Firebird SQL Development FAQs    MS SQL Development        MS SQL Development FAQs    Oracle Development        Oracle Development FAQs    LDAP Programming        LDAP Programming FAQs System Administration    Mail Server Help        Mail Server Help FAQs    Apache Development        Apache Development FAQs    Security and Cryptography        Security and Cryptography FAQs    Antivirus Protection        Antivirus Protection FAQs    DNS        DNS FAQs    IIS        IIS FAQs    Networking Help        Networking Help FAQs    FTP Help        FTP Help FAQs Operating Systems    BSD Help        BSD Help FAQs    Linux Help        Linux Help FAQs    UNIX Help        UNIX Help FAQs    Windows Help        Windows Help FAQs    Mac Help        Mac Help FAQs Web Hosting    Web Hosting        Web Hosting FAQs    Free Web Hosting        Free Web Hosting FAQs    Web Hosting Requests        Web Hosting Requests FAQs    Web Hosting Offers        Web Hosting Offers FAQs Computer Hardware    Computer Hardware    CPUs        CPUs FAQs    Cooling        Cooling FAQs    Embedded Programming        Embedded Programming FAQs    Motherboards        Motherboards FAQs    Multimedia Hardware        Multimedia Hardware FAQs Other    Dev Shed Lounge        Dev Shed Lounge FAQs    Development Articles        Development Articles FAQs    Beginner Programming        Beginner Programming FAQs    Hire A Programmer        Hire A Programmer FAQs    Project Help Wanted        Project Help Wanted FAQs Latest News Updated Hourly    Technology News    Business News    Science News Forum Information    Forum Rules/Guidelines        Forum Rules/Guidelines FAQs    Forum Announcements        Forum Announcements FAQs    Dev Shed Gaming Center        Go to the Dev Shed Battle Arena        Go to the Dev Shed Arcade Games        Go to the Legend of the Green Dragon    Suggestions & Feedback        Suggestions & Feedback FAQs

 Forums: » Register « |  Free Tools |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |