@frozen
public struct ARC4RandomNumberGenerator : SeedableRandomNumberGenerator
An implementation of SeedableRandomNumberGenerator
using ARC4.
ARC4 is a stream cipher that generates a pseudo-random stream of bytes. This PRNG uses the seed as its key.
ARC4 is described in Schneier, B., “Applied Cryptography: Protocols, Algorithms, and Source Code in C”, 2nd Edition, 1996.
An individual generator is not thread-safe, but distinct generators do not share state. The random data generated is of high-quality, but is not suitable for cryptographic applications.
-
Declaration
public static var global: ARC4RandomNumberGenerator
-
Initialize ARC4RandomNumberGenerator using an array of UInt8. The array must have length between 1 and 256 inclusive.
Declaration
public init(seed: [UInt8])
-
Declaration
public mutating mutating func next() -> UInt64