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?
[stevenlm87]: Needs help. I am taking an online class for perl and is using Padre. How can I get a list from the input in this code? print "What are your favorite hobbies? "; my $hobbies = <STDIN>; chomp $hobbies; print "Your favorite hobbies are '$hobbies'\n";

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2017-02-23 19:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (350 votes). Check out past polls.