#include #include #include // preferred method for defining array size: #define MAXDICE 10 /* Bug can be induced, if we change the above line to: #define MAXDICE 9 */ /* Solution: In the "for" line we broke the preferred method of using array sizes. for (i=0; i same sequence srand(time(0)); // initialize with system time // ! resolution: 1 s int dice[MAXDICE]; // array to store dice rolls int i; for (i=0; i<10; i++) { dice[i] = rand() % 6 +1; // :) http://xkcd.com/221/ /*// Help: // maybe this will help to find the bug: printf("\n[i=%d] ", i); */ printf("%d, ", dice[i]); } printf("\n"); return 0; }