Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: Random 1-1 mapping

by tomazos (Deacon)
on May 28, 2006 at 18:54 UTC ( #552204=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $result = ($prime_number * $input + $seed) % $max;
    
  2. or download this
    shuffle(5,10,0) == (7 * 0 + 5) % 10 == 5 % 10 == 5
    shuffle(5,10,1) == (7 * 1 + 5) % 10 == 12 % 10 == 2
    ...
    shuffle(5,10,7) == (7 * 7 + 5) % 10 == 54 % 10 == 4
    shuffle(5,10,8) == (7 * 8 + 5) % 10 == 61 % 10 == 1
    shuffle(5,10,9) == (7 * 9 + 5) % 10 == 68 % 10 == 8
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://552204]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (1)
As of 2023-09-27 05:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?