Here's working code that takes input of a low and high number from the user, generates an array, prints the array in order and then shuffles using a Fisher-Yates inspired shuffle with rand() and prints the shuffled array. It should work for nearly any range of numbers and could be used to shuffle characters as well with some minor modifications.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void)
{
int low, high;
printf("Choose a range of numbers and first enter the lowest number in the range: ");
scanf("%d", &low);
printf("Please enter the highest number in the range: ");
scanf("%d", &high);
int arraylength = high - low + 1;
int numarray[arraylength];
printf("Here is your range of numbers in numerical order:\n");
/* Create array from low and high numbers provided. */
int i;
int j = low;
for (i = 0; i < arraylength; i++)
{
numarray[i] = j + i;
printf("%d\t", numarray[i]);
}
/* Shuffle array. */
srand(time (NULL));
int temp;
int randindex;
for (i = 0; i < arraylength; i++)
{
temp = numarray[i];
randindex = rand() % arraylength;
if (numarray[i] == numarray[randindex])
{
i = i - 1;
}
else
{
numarray[i] = numarray[randindex];
numarray[randindex] = temp;
}
}
printf("\nHere is your range of numbers in random order:\n");
/* Print shuffled array. */
for (i = 0; i < arraylength; i++)
{
printf("%d\t", numarray[i]);
}
getchar();
return 0;
}