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

Re: random index in array - no duplicates

by boo_radley (Parson)
on Jun 07, 2002 at 00:54 UTC ( [id://172406]=note: print w/replies, xml ) Need Help??


in reply to random index in array - no duplicates

do you mean something like :

my @foo = (1..100); my @bar= sort {rand(1)<=>rand(1)} @foo; print "how many elements?"; my $num = <STDIN>; chomp $num; print join" ", @bar [(0..--$num)];

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-19 21:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found