samedi 21 octobre 2017

swift check all combinations from random to be done

want to check if a randomized combination is already taken and fully done, but cannot figure out how to proceed:

let x: String
        for i in 0 ..< SecondArray.count  {
        var random = SecondArray[Int(arc4random_uniform(UInt32(SecondArray.count)))]
            if (SecondArray[i] != random) {
                    print("\(SecondArray[i]) fits to: \(random)")
        }

For count = 3 output is following, as an example:

user 2.1 fits to: user 2.2
user 2.2 fits to: user 2.3
user 2.3 fits to: user 2.2

Now I want to get rid of last output line as this should be + show last randomized combination:

user 2.3 fits to: user 2.1

Any idea how to fix this?

THX. CHeers simoasis

Aucun commentaire:

Enregistrer un commentaire