Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: array problem

by dws (Chancellor)
on Mar 15, 2002 at 02:44 UTC ( #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? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2022-01-27 23:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (72 votes). Check out past polls.

    Notices?