Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: Random 1-1 mappingby BerntB (Deacon) |
on May 28, 2006 at 18:44 UTC ( [id://552202]=note: print w/replies, xml ) | Need Help?? |
What you want is a perfect hash function, that is inexpensive in computing time?
Why not ask for something simple, like a perpetum mobile? :-)
The Update: If you could keep $max to a power of 2, you could maybe XOR with a constant? (Update2: The $seed (constant) would also have to be as many bits as $max.)
Code example for Update (n.b. $max must be 2^X):
In Section
Seekers of Perl Wisdom
|
|