C++ Array Shuffle

后端 未结 10 2000
温柔的废话
温柔的废话 2021-01-07 14:06

I\'m fairly new to C++ and don\'t quite understand function parameters with pointers and references. I have an array of Cards that I want to shuffle using the Fisher-Yates

10条回答
  •  庸人自扰
    2021-01-07 14:42

    Just use std::random_shuffle found in , like this:

    std::random_shuffle(deck, deck + deckSize);
    

    and your deck with be shuffled.

提交回复
热议问题