in reply to Re: Re: Answer: How can I print all the numbers from 1 to n in random order?
in thread How can I print all the numbers from 1 to n in random order?
A hashtable implementation might decide to visit the values %foo in a key order which looks suspiciously artificial: 0.05, 0.10, 0.15, 0.20, 0.06, 0.11, 0.16, 0.21, etc. You are hoping that the hashtable implementation doesn't actually bear any relationship to the pseudo-random number generator. Well, as seen in a recent security bug-fix, hash functions CAN be tied to random functions. You might end up aligning the two functions and defeating any appearance of unpredictability.
This hashtable technique is interesting, but I wouldn't trust it to return things in a random order.
--
[ e d @ h a l l e y . c c ]
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Answer: How can I print all the numbers from 1 to n in random order?
by ysth (Canon) on Apr 23, 2004 at 16:30 UTC |