From 58d1e46628b2d54d80723a3cce13dc7e6199af8e Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Sat, 24 Jul 2021 00:58:40 +0200 Subject: [PATCH] Spider: Use AK::get_random_uniform() instead of rand()/srand() This also has the added benefit that after a restart we don't get the same random numbers all the time because we forgot to initialize the RNG with srand(). --- Userland/Games/Spider/Game.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Userland/Games/Spider/Game.cpp b/Userland/Games/Spider/Game.cpp index 74e1f5efd5..a19888ade5 100644 --- a/Userland/Games/Spider/Game.cpp +++ b/Userland/Games/Spider/Game.cpp @@ -5,6 +5,7 @@ */ #include "Game.h" +#include #include #include @@ -72,7 +73,7 @@ void Game::setup(Mode mode) m_new_deck.clear_with_capacity(); m_new_deck.ensure_capacity(deck.size()); while (!deck.is_empty()) - m_new_deck.append(deck.take(rand() % deck.size())); + m_new_deck.append(deck.take(get_random_uniform(deck.size()))); m_new_game_animation = true; start_timer(s_timer_interval_ms);