1. ## perfect randomness?

In my other post with the subject frequency? , the result comes out to be 52 for heads and 48 for tails. It means that it is not 100% randomized result. If had been correctly randomized the result should have been 50 for heads and 50 for tails, know what I mean? How can I achieve perfect randomness in this case?

here is the code which I posted and later corrected.

Code:
```#include<iostream>	/* include header files */
#include<conio.h>	/*                      */
#include<iomanip>	/*                      */

using std::cout;
using std::cin;
using std::endl;
using std::setw;

void flip();	// prototype

int main()
{
flip();	// function call
}

void flip(void)
{
int frequency1=0;	// declare & initialize frequency1 to 0
int frequency2=0;	// declare & initialize frequency2 to 0
int face;	// declare face

for(int toss=1; toss<=100; toss++)	// coin tossed 100 times
{
face=1+rand()%2;	// generate randomly 1 | 2
switch(face)	// switch face
{
case 1:
break;
case 2:
++frequency2;	// increment tails
break;
default:
cout<< "It should never get here:";	// default should never occur
break;	// optional
}	// exit switch
}	// exit for loop

cout<< setw(10) << "Face" << setw(13) << "Frequency" << endl;	// display results
cout<< setw(10) << "Heads" << setw(13) << frequency1 << endl;
cout<< setw(10) << "Tails" << setw(13) << frequency2 << endl;
}```

2. Why?

No other coin tossing experiment will ever produce a 50:50 result every single time.

Perhaps you should try a few real experiments yourself.

3. actually, if you flip a coin, you'll usually get something more like 33:66 result... try it yourself and you'll notice that you get heads/tails 6 or 7 times in a row... that's just teh way it is... if you do it 50 million times, it'll be closer to 50:50, but if you only do it about 50 times, you definatley won't get 50:50...

4. This only applies if you keep going on in eternity, and of course when you calculate it on a paper but it wont apply in real life, only if you do it to eternity.

5. 1) Your computer cannot generate random numbers. It can generate numbers that APPEAR to be random, but they do have a pattern to them. True random number generators are not built solely out of electronics -- for example, they may include radioactive sources (radioactive decay being a random event).

2) It is only with an infinite number of flips that you get exactly 50/50 on a coin flip. 50% is the mean, and the expected value of any set of coin flips, but the means will have some deviation -- that is, you won't always get exactly 50/50 splits. For example, a 60/40 split is still fairly likely on 100 flips of a coin.

6. A coin toss isn't random, the force rotation and direction of force in addition to obscuritues, friction and distance to travel will result in the side that is face up, nothing is truly random, everything can be mathematically calulated.

If you want an even ratio, just tell the program to stop when both frequencies are equal to each other rather than counting to 100.

7. >> nothing is truly random, everything can be mathematically calulated.

Many physical laws seem to be causal in nature. The underlying principles of quantum mechanics, however, appear to be quite random. And as of yet, there is no causal theory underlying either string theory or quantum theory.

At any rate, the principle that satets that things will get closer to the mean as you perform more trials is the "Law of Large Numbers".

A much "better" source of randomness would be, as Cat said, to use a more observably random source. One such source is the rate of radioactive decay. Another is thermal patterns on a relatively fixed object (though, this type of device would be easier to screw up by say, turning on a light in view of your camera). There was also a bit of work done with lava lamps.

If you want a different deterministic pseudo-random number generator, search for algorithms, and you'll surely find many. Linear congruential generators are fairly common.

8. >And as of yet, there is no causal theory underlying either string theory or quantum theory.
Of course, seeing as how they are both theories...

9. okeys. It means that my result 52-48 is very much random.

10. Originally posted by Prelude
>And as of yet, there is no causal theory underlying either string theory or quantum theory.
Of course, seeing as how they are both theories...
That was part of my point. At least that stuff looks random.

11. Take a look at the "Mersenne Twister" itīs supposed to be "better" and faster than the original randomizer.
http://www.math.keio.ac.jp/~matumoto/emt.html

12. There is if you think about it... aka...

Random Number: 35
Then do
RandomNumber - 8

Now there's not much of a pattern going on. Only problem is if it goes negative, then ouch.

13. anyone who programs a lot with random numbers will tell you, rand() is definitely not the way to go. there are a lot of resources on random number generators. i have a data structures book that has an entire chapter devoted to generating random numbers.

14. I program with random numbers pretty often... I haven't seen any problems with using rand() yet... as long as you seed it, it should be fine... unless there's some kind of portablitiy problem or something...

15. Originally posted by Dark Nemesis
nothing is truly random, everything can be mathematically calulated.
345
7
19
44
.5
56,023.3
3.3

That isn't truly random? I would love to see a pattern for that.