-5

what's wrong? How I can generate words or string with arc4random?? Thank you for the help

  • Possible duplicate of [Pick a random element from an array](http://stackoverflow.com/questions/24003191/pick-a-random-element-from-an-array) – Hamish Jan 16 '17 at 16:02

1 Answers1

-1

You have to restrict the results of arc4random to the length of your array.

array1[Int(arc4random_uniform(UInt32(array1.count)))]
sdasdadas
  • 23,917
  • 20
  • 63
  • 148