one solution is put all numbers in an array, scramble them and take the first 5.
int numbers[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13 };
int count = 13;
void setup()
{
Serial.begin(9600);
scrambleArray(numbers, count);
for (int i=0; i<count; i++)
{
Serial.println(numbers[i]);
}
Serial.println("----");
}
void loop()
{}
void scrambleArray(int * array, int size)
{
int last = 0;
int temp = array[last];
for (int i=0; i<size; i++)
{
int index = random(size);
array[last] = array[index];
last = index;
}
array[last] = temp;
}
Another solution is to remember the values you got "thrown", if one is already in the list rethrow the dice ...