Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Creating an array of unique numbers

by a (Friar)
on Mar 27, 2001 at 10:53 UTC ( [id://67444]=note: print w/replies, xml ) Need Help??


in reply to Creating an array of unique numbers

Well, not sure where your code goes awry (though it doesn't seem like checking the last 2, er 3 (length -2) array entries would keep the array unique - 41 is appearing as element 4 and 20) but how about a hash? Something like:
while ( scalar keys %qs < $Max - 1 ) { $qs{int(rand($lines))}++; }

a

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2024-03-28 11:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found