C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 6th, 2004, 10:37 PM
jax79sg jax79sg is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 33 jax79sg User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 45 m 47 sec
Reputation Power: 10
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?

Reply With Quote
  #2  
Old July 7th, 2004, 12:50 AM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 9th Plane (9000 - 9499 posts)
 
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
Posts: 9,390 Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 1 Day 22 h 32 m 40 sec
Reputation Power: 4080
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

Reply With Quote
  #3  
Old July 7th, 2004, 05:50 AM
mitakeet's Avatar
mitakeet mitakeet is offline
I'm Baaaaaaack!
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Jul 2003
Location: Maryland
Posts: 5,538 mitakeet User rank is Captain (20000 - 30000 Reputation Level)mitakeet User rank is Captain (20000 - 30000 Reputation Level)mitakeet User rank is Captain (20000 - 30000 Reputation Level)mitakeet User rank is Captain (20000 - 30000 Reputation Level)mitakeet User rank is Captain (20000 - 30000 Reputation Level)mitakeet User rank is Captain (20000 - 30000 Reputation Level)mitakeet User rank is Captain (20000 - 30000 Reputation Level)mitakeet User rank is Captain (20000 - 30000 Reputation Level)mitakeet User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Weeks 4 Days 2 h 38 m 46 sec
Reputation Power: 242
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.
LinkedIn Profile: http://www.linkedin.com/in/keithoxenrider

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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > Random numbers: Gaussian

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

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


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap