#include <stdio.h>
#include <stdlib.h>

int max;
int *deck;
int *used;
int i,j,redo;
int r;

int main (int argc,char *argv[])
{
	if (argc == 1) {
		printf ("need a count.\n");
		exit (0);
	}
	max = atoi (argv[1]);
	if ((max < 100) || (max > 1000000L)) {
		printf ("unreasonable values of max (0 < max < 1,000,000)\n");
		exit (0);
	}
	deck = (int *)malloc(max * sizeof(int));
	used = (int *)calloc(max + 1, sizeof(int));
	for (i=0;i<max;i++) {
		do {
			redo = 0;
			r = (random() % max) + 1;
			if (used[r]) {
				redo = 1;
			} else {
				deck[i] = r;
				used[r] = i;
			}
		} while (redo == 1);
	}
	return 0;
}


		

