0 MasterGberry -3 7 Years Ago I took my deck of Cards (class Card) and shuffled the. But every time i ran the program it gave me the same shuffled results.... void Deck::shuffleDeck() { std::random_shuffle(deck.begin(), deck.end()); } c++
1 Featured Reply arkoenig 340 7 Years Ago Did you call srand first? Votes + Comments MasterGberry: fast response
0 OPDiscussion Starter MasterGberry -3 7 Years Ago just realizes i forgot that. Is it just srand(time(NULL));? EDIT: Nvm, works now. Dumb mistake by me :P ty Edited 7 Years Ago by MasterGberry: n/a
0 erikandr 7 Years Ago Try: void Deck::shuffleDeck() { srand(time(NULL)); // Set seed for random numbers std::random_shuffle(deck.begin(), deck.end()); } Cheers, Erik Edited 5 Years Ago by mike_2000_17: Fixed formatting