gpt4 book ai didi

Linux 中的 Swift arc4random_uniform(max)

转载 作者:IT王子 更新时间:2023-10-29 05:26:04 27 4
gpt4 key购买 nike

我在 Ubuntu 中使用 Swift,我收到一个错误,指出 arc4random 是一个未解析的标识符。有关此已知错误的更多信息 here .基本上,该功能只存在于 BSD 发行版中。我尝试了模块映射头文件、apt-getting 包,但我得到的错误越来越多,这不值得追求,因为这个功能并不经常使用。

有没有兼容Linux Swift的上界参数获取伪随机数的函数?

最佳答案

swift 4.2

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

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

附言。它适用于 Linux。

关于Linux 中的 Swift arc4random_uniform(max),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41035180/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com