Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Get random unique lines from file

by roboticus (Canon)
on Aug 17, 2012 at 22:54 UTC ( #988117=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl                             
    #                                           
    ...
                                                
    print "random samples:\n";                  
    print $$_[1] for sort { $$a[0] <=> $$b[0] }  @samples;                
    +                                        
    
  2. or download this
    $ perl -e 'print "$_\n" for 1 .. 1000000' >a_million_lines
    
    ...
    719979
    842687
    998139
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (9)
As of 2014-07-11 03:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (217 votes), past polls