I want that my two random generated labels does not generate the same number like 5 and 5
I have done everything else but this
else if rightScoreLabel == leftScoreLabel {
// what goes here?
{
sorry i’m starter
I want that my two random generated labels does not generate the same number like 5 and 5
I have done everything else but this
else if rightScoreLabel == leftScoreLabel {
// what goes here?
{
sorry i’m starter
Try approaching this another way: keep generating new numbers until you have two different values.
var a = 0
var b = 0
while a == b {
a = Int(arc4random_uniform(10))
b = Int(arc4random_uniform(10))
}
Alternatively, you can regenerate just one of the numbers:
var a = Int(arc4random_uniform(10))
var b = 0
repeat {
b = Int(arc4random_uniform(10))
} while a == b