#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define LENTH 54
void init_brand(int *array);
int main()
{
int brand[LENTH];
int shuffle[LENTH];
int i, j;
int index;
int random_num;
init_brand(brand);
srand(time(0));
for(i = 0; i != LENTH; i++)
{
index = rand()%(LENTH-i);
j = 0;
random_num = 0;
do
{
if(brand[random_num] != -1)
{
j++;
}
random_num++;
}
while(j != index+1);
shuffle[i] = brand[random_num-1];
brand[random_num-1] = -1;
}
for(i = 0; i != LENTH; i++)
{
if(i == 0 ||
i == 17 ||
i == 35)
{
printf("\n---------------------------------------------\n");
}
printf("%d ", shuffle[i]);
}
return 0;
}
void init_brand(int *array)
{
int i;
for(i = 0; i != LENTH; i++)
{
*(array+i) = i + 1;
}
}