tweak with_rng signature to allow Rng reuse

This commit is contained in:
2026-05-18 13:28:40 -07:00
parent 07c3dc6667
commit 13bc36ce0c
+4 -4
View File
@@ -541,14 +541,14 @@ pub struct Klondike {
impl Klondike {
pub fn with_seed(seed: u64) -> Self {
use rand::SeedableRng;
let rng = Rng::seed_from_u64(seed);
Self::with_rng(rng)
let mut rng = Rng::seed_from_u64(seed);
Self::with_rng(&mut rng)
}
pub fn with_rng(mut rng: Rng) -> Self {
pub fn with_rng(rng: &mut Rng) -> Self {
// shuffle a new deck
let mut deck = Stack::full_deck(card_game::Deck::Deck1);
use rand::seq::SliceRandom;
deck.shuffle(&mut rng);
deck.shuffle(rng);
let mut deck = deck.into_iter();
// generate tableaus