diff --git a/src/timequiz.c b/src/timequiz.c index f3931e9..28f828b 100644 --- a/src/timequiz.c +++ b/src/timequiz.c @@ -54,8 +54,13 @@ void timequiz() { memset(askedQuestions, 0, sizeof(askedQuestions)); srand((unsigned int)time(NULL)); +} int getRandomQuestionIndex(int askedQuestions[], int totalQuestions) { + int questionIndex; + do { + questionIndex = rand() % totalQuestions; + } while (askedQuestions[questionIndex] == 1); + return questionIndex; } -}