Swift arc4random_uniform(max) in Linux

后端 未结 4 1021
猫巷女王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:36

    You could try something like this?

        #if os(Linux)
           random()
        #else
            arc4random_uniform()
        #endif
    

提交回复
热议问题