#!/usr/bin/perl -w
#
# returns a subset of M 1s among N-M zeroes
# usage:
#   randNchooseM.p N=10000 M=100

$newlines=1;
$N = 273 ;
$M=82 ; 
$seed="123"; # new feature 99 07 30

eval "\$$1=\$2" while @ARGV && $ARGV[0]=~ /^(\w+)=(.*)/ && shift;
srand($seed) ;

while($N ) {
    if ( ($M *1.0/$N) > rand() ) {
	print "1" ;
	$M -- ;
    } else { print "0" ; }
    print "\n" if ($newlines) ; 
    $N -- ;
}

