mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:27:45 +00:00
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().
This commit is contained in:
parent
807b79d89e
commit
58d1e46628
1 changed files with 2 additions and 1 deletions
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include "Game.h"
|
||||
#include <AK/Random.h>
|
||||
#include <LibGUI/Painter.h>
|
||||
#include <LibGfx/Palette.h>
|
||||
|
||||
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue