#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/time.h>
#include <math.h>

static const int	low = '!';
static const int	high = '~';

int
main(int argc, char * * argv)
{
	const float		range = high - low;
	struct timeval		t;
	int			i,j;
        int 			cnt, len, secure=0;
        char			buf[20];

	gettimeofday(&t, 0);

       if (argc < 2 || argc > 3) {
                fprintf(stderr, "Usage: %s maxlength [count]\n", argv[0]);
                exit(1);
        }
        if ((len = atoi(argv[1])) < 4 || len > 16) {
                fprintf(stderr, "%s: invalid maxlength %s\n", argv[0], argv[1]);
                exit(1);
        }
        if (argc == 2)
                cnt = 1;
        else if ((cnt = atoi(argv[2])) < 1) {
                fprintf(stderr, "%s: invalid count %s\n",  argv[0], argv[2]);
                exit(1);
        }


	srand48(t.tv_sec + t.tv_usec * 102457 + getpid() + getppid());
	
	for ( j = 0 ; j < cnt ; j++ ) {
	for ( i = 0 ; i < len ; i++ ) {
		int c = low + (int)(drand48() * range);
		switch ( c ) {
		case '\\':
		case '\'':
		case '\"':
			c = '%';
		}
		printf("%c", c);
	}
	printf ("\n");
	}

	return 0;
}


syntax highlighted by Code2HTML, v. 0.9.1