Swift arc4random_uniform(max) in Linux

后端 未结 4 1023
猫巷女王i
猫巷女王i 2021-02-14 00:06

I\'m working with Swift in Ubuntu, and I am getting an error that arc4random is an unresolved identifier. More information on this known bug here. Basically, the function only e

4条回答
  •  滥情空心
    2021-02-14 00:33

    Swift 4.2

    let random = Int.random(in: 0...100)
    

    https://developer.apple.com/documentation/swift/int/2995648-random

    PS. It works in Linux.

提交回复
热议问题