PCG 伪随机数生成器

standwithukraine cocoapods

PCG 随机数生成器,用于 Swift 语言。

安装

Swift 包管理器

dependencies: [
    .package(url: "https://github.com/paiv/swift-pcg-random.git", .upToNextMajor(from: "1.0.0"))
]

CocoaPods

pod 'PcgRandom', '~> 1.0'

用法

import PcgRandom
var pcg = Pcg64Random(seed: 42)
let dice = Int.random(in: 1...20, using: &pcg)
print(dice)