Help for this page

Select Code to Download


  1. or download this
    while (<IN>){
          while ($count<=$size){
    ...
                $count++;    
                }
            }
    
  2. or download this
    while (<IN>){
        rand($.)<1 && ($line=$_);
    }
    print OUT $line;
    
  3. or download this
    my @lines = <IN>;
    for my $c (1 .. 300) {
    ...
        }
        print OUT $line;
    }
    
  4. or download this
    my @lines = <IN>;
    for my $c (1 .. 300) {
        print OUT $lines[int rand @lines];
    }
    
  5. or download this
    use List::Util qw(shuffle);
    my @lines = shuffle(<IN>);
    print OUT @lines[0 .. 299];