swift - Random Number Generator - Display 1 instead of Zero -
this question has answer here:
in xcode 7 & swift have label generates random number between 0 - 50, when generates 0 want display number 1 instead. code need add this?
label1textlabel.text = string(arc4random_uniform(51))
regards.
del
write code:
var number = int(arc4random() % uint32(51)) if number == 0 { number = 1 } label1textlabel.text = "\(number)"
Comments
Post a Comment