diff options
-rw-r--r-- | Userland/Libraries/LibCards/Card.cpp | 9 | ||||
-rw-r--r-- | Userland/Libraries/LibCards/Card.h | 1 |
2 files changed, 1 insertions, 9 deletions
diff --git a/Userland/Libraries/LibCards/Card.cpp b/Userland/Libraries/LibCards/Card.cpp index 90ecf84830..b6fc71826b 100644 --- a/Userland/Libraries/LibCards/Card.cpp +++ b/Userland/Libraries/LibCards/Card.cpp @@ -80,16 +80,9 @@ ErrorOr<NonnullRefPtrVector<Card>> create_deck(unsigned full_club_suit_count, un TRY(add_cards_for_suit(Cards::Suit::Spades, full_spade_suit_count)); if (shuffle == Shuffle::Yes) - shuffle_deck(deck); + AK::shuffle(deck); return deck; } -void shuffle_deck(NonnullRefPtrVector<Card>& deck) -{ - auto iteration_count = deck.size() * 4; - for (auto i = 0u; i < iteration_count; ++i) - deck.append(deck.take(get_random_uniform(deck.size()))); -} - } diff --git a/Userland/Libraries/LibCards/Card.h b/Userland/Libraries/LibCards/Card.h index 5e86170939..2c828a91de 100644 --- a/Userland/Libraries/LibCards/Card.h +++ b/Userland/Libraries/LibCards/Card.h @@ -133,7 +133,6 @@ enum class Shuffle { }; ErrorOr<NonnullRefPtrVector<Card>> create_standard_deck(Shuffle); ErrorOr<NonnullRefPtrVector<Card>> create_deck(unsigned full_club_suit_count, unsigned full_diamond_suit_count, unsigned full_heart_suit_count, unsigned full_spade_suit_count, Shuffle); -void shuffle_deck(NonnullRefPtrVector<Card>&); } |