#!/usr/bin/perl
# Select N lines at random from the input (without knowing how long it is!)
# N is 10 by default -- change on command line by
# nrandom N=100
#   or whatever
$N = 10;
#$/="";
eval "\$$1=\$2" while $ARGV[0] =~ /^(\w+)=(.*)/ && shift;
srand;
$i = 0;
$c = 1;
$p = 1;
while(<>){
  if(rand($c) < 1){
	$it[$i] = $_;
  }
  $i++;
  if($i >= $N){
     $i = 0;
     $c++;
  }
}
{
  local $, = "";
  print @it;
}
