Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: array problem

by dws (Chancellor)
on Mar 15, 2002 at 02:44 UTC ( [id://151890]=note: print w/replies, xml ) Need Help??


in reply to array problem

Another approach is to shuffle a set of indices using a Schwartzian transform, and then use a subset of the randomized indices to select a subset of the images.
my @indices = map { $_->[0] } sort { $a->[1] <=> $b->[1] } map { [$_, rand()] } 0 .. $#arr; my @subset = @arr[@indices[0..$number_to_show - 1]];

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-25 15:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found