0

I am making a simple guessing game in Swift, and have been using arc4random to generate a random number. However, when I run the app, it fails and gives me the error message "Argument passed to call that takes no arguments." The code that receives the error message is below:

var randomNumber = arc4random(50) + 1

I am fairly new to Swift, so please enlighten me!

  • 4
    Wrong function. Use arc4random_uniform instead. See http://stackoverflow.com/a/29956021/2227743 for explanations. – Eric Aya Dec 28 '16 at 17:40
  • 1
    http://stackoverflow.com/questions/32552336/generating-random-numbers-with-swift-2/32552511#32552511 – Arsen Dec 28 '16 at 17:46
  • It's not really a Swift problem. If you open a terminal session and type "man arc4random" it will show you a description of how to use it and related functions. – Phillip Mills Dec 28 '16 at 17:59
  • http://stackoverflow.com/questions/29955823/whats-the-difference-between-arc4random-and-arc4random-uniform/29956021#29956021 – mrabins Dec 28 '16 at 18:41

0 Answers0