dimanche 11 septembre 2016

How get only certain quantity of random numbers in an array using Swift

I want get only certain amount of numbers using arc4random(), the problem is I don't know how use very well arc4random(). I only know how use random(), I know is very old but this is giving me the entire amount of numbers that I have in my array. Thank you! Here is my code so far:

private func randomNumber() {
    let numberQ = numbers.count

    if number > 0{
        numberRand= arc4random(5) % numbers.count
} else {

}




Aucun commentaire:

Enregistrer un commentaire