#!/usr/local/bin/perl -w # random - send random characters to standard output # (used to test sanity checking in programs) # # optional argument is number of bytes to output; default is infinite srand; # seed random number generator based on time if ($#ARGV < 0) { while (1) { &rndchr; } } else { $count = $ARGV[0]; # number of bytes to output for ($i=0 ; $i<$count ; $i++) { &rndchr; } } sub rndchr { local ($c); $c = sprintf ('%c',rand(255)); print $c; $c; }