From 873dc2772ad5e5d90f63a1d35e5164f0b95e7c86 Mon Sep 17 00:00:00 2001 From: parthpandey1 Date: Tue, 21 Feb 2023 12:22:26 -0800 Subject: [PATCH] Fixed build failure due to rand_r(). Fixes Issue#2 --- GameDie.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GameDie.cpp b/GameDie.cpp index d8ecb3a..bab95cf 100644 --- a/GameDie.cpp +++ b/GameDie.cpp @@ -29,7 +29,7 @@ GameDie::GameDie(unsigned int num) { // generate a random number between 1-n where n is the counter size // (inclusive) and return it int GameDie::roll() { - int roll = rand_r() % roll_counter.size(); + int roll = rand_r(5) % roll_counter.size(); roll_counter[roll]++; return roll + 1; }