Code:
void main()
{
	randomize();
	
	int n;
	int numbers[10];
	int array[192];
	for(n=0; n<192; n++) array[n] = n + 1;  // fill array with 1..192
	
	for(n=0; n<10; n++)
	{
	    int index = random((191-n)+1);
	    numbers[n] = array[index];
	    array[index] = array[191-n]; // remove the number from the array by replacing it with the last one in the array (the last one won't be accessed anymore)
	}
	
	X_1 = numbers[0];
	X_2 = numbers[1];
	...
	X_10 = numbers[9];
	
	printf("%d %d %d %d %d %d %d %d %d %d", numbers[0], numbers[1], numbers[2], numbers[3], numbers[4], numbers[5], numbers[6], numbers[7], numbers[8], numbers[9]);
	
}




Last edited by Widi; 04/22/10 22:57.