Make sure randomly generated numbers are different in Swift
<p>I am generating numbers from 1-52 (to deal out random playing cards), however I want to make sure that none of them are the same. In total a max of 17 cards will be dealt out, and they must be different. This is not a duplicate, as no question answers how to check for repetitions in random numbers of more that 2 different values.</p>

<p>Here is a shortened version of the code for convenience:</p>

<pre><code>    let randomPlayerCard1 = Int(arc4random() % 52) // Generates random numbers
    let randomPlayerCard2 = Int(arc4random() % 52)
    let randomCentreCard1 = Int(arc4random() % 52)
    let randomCentreCard2 = Int(arc4random() % 52)
    let randomCentreCard3 = Int(arc4random() % 52)
    let randomCentreCard4 = Int(arc4random() % 52)
    let randomCentreCard5 = Int(arc4random() % 52)

    while randomPlayerCard1 == randomPlayerCard2  { /* I don't want to create "while" 
statement for every combination of 2 of the eventual 17 random values being equal*/

    }
    playerCard1.image = mapping[randomPlayerCard1]
    playerCard2.image = mapping[randomPlayerCard2]
</code></pre>

<p>I also tried something like:</p>

<pre><code>while randomPlayerCard1 == randomPlayerCard2 == randomCentreCard5 == randomCentreCard3
</code></pre>

<p>But your not allowed to do that, as I expected.</p>

<p>Thank you for any help!</p>