Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Check randomly generated numbers have not been used before

by InfiniteSilence (Curate)
on Jun 20, 2014 at 13:44 UTC ( #1090636=note: print w/replies, xml ) Need Help??


in reply to Check randomly generated numbers have not been used before

perl -e 'for (0..100){$randhash{int (rand() * 100)} += 1}; print join +qq|\n|,sort {$a<=>$b} keys %randhash;'

Check elements that have > 1 in the value and recompute until you find a key that does fails exists.

Celebrate Intellectual Diversity

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2022-01-21 11:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (57 votes). Check out past polls.

    Notices?