#!/usr/bin/perl -w
#  Gertjan van Noord, 1997.
# mailto:vannoord@let.rug.nl

use strict;
use vars qw($opt_h $opt_n);
use Getopt::Std;
$opt_n=5000;

# OPTIONS
getopts('n:h');

sub help {
    print STDERR "
Usage: $0 [-n Nr] [Files]

writes random lines upto Nr bytes from standard input or Files 
to standard output. Default: 5000.
";
}

if ($opt_h) { &help; exit 0; };

my @in=<>;
my @out=();
my $length=0;
my $new="";
while (@in && $length < $opt_n) {
    $new=@in[rand(@in)];
    $length=$length+length($new);
    @out=(@out,$new);
}

print @out;
