The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> C Programming
|
Random numbers: Gaussian
Discuss Random numbers: Gaussian in the C Programming forum on Dev Shed. Random numbers: Gaussian C programming forum discussing all C derivatives, including C#, C++, Object-C, and even plain old vanilla C. These languages are low level languages, and used on projects such as device drivers, compilers, and even whole computer operating systems.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

July 6th, 2004, 10:37 PM
|
|
Contributing User
|
|
Join Date: Aug 2003
Posts: 33
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?
|

July 7th, 2004, 12:50 AM
|
 |
Banned ;)
|
|
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
|
|
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
|

July 7th, 2004, 05:50 AM
|
 |
I'm Baaaaaaack!
|
|
Join Date: Jul 2003
Location: Maryland
|
|
|
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.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|