I got the same result
H T T T T H H H H
T T T H H H H H H
......
and the same count for each H and T for every execution...
perhaps, I should use "srand"
I got the same result
H T T T T H H H H
T T T H H H H H H
......
and the same count for each H and T for every execution...
perhaps, I should use "srand"
Yes, if you want each time you run the code to produce different results, you should use some sort of random seed that varies from time to time.
All of the traditional random number generators that are used by computers generate a series of numbers based on a "seed". If you start with the same seed, you get the same sequence. If you start with very similar seeds, it's likely that you get a similar result - but by no means guaranteed.
So running your code twice in a row using time(0) as a seed may produce a very similar result, because the "time" may be close enough to produce the same result. If you wait for several seconds before running it again, then you would be more safe.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
heh. welcome to the world of PRNGs.
QRBG is the way to go http://cboard.cprogramming.com/showthread.php?t=103071
kidding . srand(time(NULL)) would probably work ok for you, though I found that one needs to wait at least 1 second between each call, and even then the results were largely linear.