mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-06 02:55:49 +03: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
Notes:
sideshowbarker
2024-07-18 08:25:01 +09:00
Author: https://github.com/gunnarbeutner Commit: https://github.com/SerenityOS/serenity/commit/58d1e46628b Pull-request: https://github.com/SerenityOS/serenity/pull/8970
@ -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…
Reference in New Issue
Block a user