Random

public struct Random

This can be used to securely generate random data.

  • Securely generate a random sequence of bytes.

    Declaration

    Swift

    public static func bytes(count: UInt32) -> Bytes

    Parameters

    count

    The amount of bytes.

  • Securely generate a random number.

    Declaration

    Swift

    public static func number() -> UInt32
  • Securely generate a random number with a given upper bound. The result has a uniform distribution in the Range of 0..<upperBound.

    Declaration

    Swift

    public static func number(withUpperBound upperBound: UInt32) -> UInt32