![]() |
|
|
#23 | ||
|
Jun 2003
The Texas Hill Country
32·112 Posts |
Quote:
|
||
|
|
|
|
|
#24 |
|
Aug 2003
Snicker, AL
7×137 Posts |
There's nothing like a spirited discussion (think fists, blood, and cursing) to get you going in the morning!
The oldest and arguably most effective trick in the world is to prime the random number generator from a pseudo random source. Using the internal clock as I did above is reasonably effective. There are also tricks that can be used to set sound wave generators on a relatively fast cycle and then read the numeric level of the volume and use that number to prime the random number generator. That said, this has become a fairly interesting thread. I will point out a minor flaw with some of the routines above. for i = 1 to 52 generate random number, r, such that i <= r <= 52 swap the cards i and r next i This routine yields a fairly high probability that some cards remain in their original order. The routine I use as above would roughly translate as: for i = 52 to 1 step -1 Generate a random number, r, such that i <= r <= 52 move the card r to new array in position i move all higher cards down 1 .... or replace card r with i in NickGlover's version. next i The result is that the next card selected can never be one of the previous selected cards because those cards are in another array. This significantly increases the randomization effectiveness. Fusion - who hasn't had time to finish up his program, too much to do! One more note, one of the major uses for huge prime numbers is as seeds in random number generators. The larger the prime, the greater the probability of random results! |
|
|
|
|
|
#25 | ||
|
Jun 2003
The Texas Hill Country
100010000012 Posts |
Quote:
As a result, I believe that the sequence generated is perfectly random if the random number generator is truely random. I cannot support your assertion that Quote:
|
||
|
|
|
|
|
#26 |
|
Aug 2003
Snicker, AL
7×137 Posts |
Wackerbarth,
I did look at it again and you are correct. It is highly random. The only issue is just how random is random. Unfortunately, my routine has the same concern. Fusion |
|
|
|
![]() |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Prime gap programming challenge | robert44444uk | Software | 21 | 2017-04-13 09:40 |
| Need some help on php programming | pinhodecarlos | Programming | 2 | 2012-07-23 18:17 |
| New to programming. What to do? | lorgix | Miscellaneous Math | 9 | 2010-12-08 22:22 |
| plz, help me in c programming | alaa | Homework Help | 12 | 2007-06-12 22:17 |
| Powerful Numbers programming challenge | geoff | Programming | 31 | 2005-02-20 18:25 |