0
#include "card.h"
#include "cardDeck.h"
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <iostream>

using namespace std;

CardDeck::CardDeck(bool newCardDeck)
{
    if(!newCardDeck)
        return;

    for(int i = DIAMONDS; i <= SPADES; i++) {
        for(int j = SIX; j <= ACE; j++) {
            Card * temp = new Card(i, j);
            deck.push_back(temp);
        }
    }

    // shuffle the cards using built in function (in algorithm)
    random_shuffle(deck.begin(), deck.end());
}

At first, compiler showing warning about depreciated with random shuffle then I change the format to std::shuffle and it shown up as "no matching function to "shuffle" in XCODE

Compiler warning

Switching to std::shuffle

Chaz Ben
  • 13
  • 5
  • `void shuffle(RandomIt first, RandomIt last, URBG&& g)`. You have to pass a random number generator to it. – Evg Aug 02 '20 at 05:47
  • And how would I do that? Thank you! – Chaz Ben Aug 02 '20 at 05:51
  • See the [accepted answer](https://stackoverflow.com/a/6926473) in [this](https://stackoverflow.com/q/6926433) question. – Evg Aug 02 '20 at 05:52

0 Answers0