Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Selecting random records from an array

by I0 (Priest)
on Jun 04, 2003 at 01:35 UTC ( #262855=note: print w/ replies, xml ) Need Help??


in reply to Selecting random records from an array

my $n = @input*.75; my $m = @input; my @subset = grep rand($m--)<$n?$n--:0, @input;


Comment on Re: Selecting random records from an array
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://262855]
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: (7)
As of 2015-04-28 10:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who makes your decisions?







    Results (519 votes), past polls