Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Is there an easy way to assign guaranteed unique values to a simple array without looping through whole array?

by traveler (Parson)
on Nov 30, 2007 at 00:08 UTC ( #654011=note: print w/ replies, xml ) Need Help??


in reply to Is there an easy way to assign guaranteed unique values to a simple array without looping through whole array?

Another way to look at this is that you want a shuffled version of some list. Take (1..7) for example. With Algorithm::Numerical::Shuffle you can do that easily:

@array = shuffle(1..7);
The idea of shuffling an array has been discussed before (and other places, too).

HTH, --traveler


Comment on Re: Is there an easy way to assign guaranteed unique values to a simple array without looping through whole array?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2015-05-30 03:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    In my home, the TV remote control is ...









    Results (593 votes), past polls