PseudorandomNumberGenerator

public final class PseudorandomNumberGenerator : Randomizer

A pseudorandom number generator.

Currently, PseudorandomNumberGenerator uses the xoroshiro128+ algorithm designed by David Blackman and Sebastiano Vigna.

  • The seed.

    Declaration

    Swift

    public typealias Seed = (UInt64, UInt64)
  • An automatically seeded pseudorandom number generator for general use.

    Note

    If deterministic behaviour is needed, use init(seed: Seed) instead.

    Declaration

    Swift

    public static let defaultGenerator: PseudorandomNumberGenerator =
  • Returns a new, randomly generated seed.

    Declaration

    Swift

    public static func generateSeed() -> Seed
  • Creates a pseudorandom number generator with a specific seed.

    Declaration

    Swift

    public init(seed: Seed)

    Parameters

    seed

    The seed.

  • Returns a random value.

    See also

    randomNumber(inRange:)

    Declaration

    Swift

    public func randomNumber() -> UIntMax