SeedableRandomNumberGenerator
public class SeedableRandomNumberGenerator : RandomNumberGenerator
A basic implementation of a random number generator that can be given a seed. It depends on srand48() and drand48(), so any calls to those two functions outside of this class will impact the reproducibility of the generator.
-
Creates a new instance and seeds the generator using a call to
srand48(seed)
.Declaration
Swift
public init(seed: Int = 0)
-
Generates the next random number; uses drand48().
Declaration
Swift
public func next() -> UInt64