Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "random/random"

Index

Variables

defaultRandomSource

defaultRandomSource: SystemRandomSource = new SystemRandomSource()

Functions

randomBytes

  • randomBytes(length: number, prng?: RandomSource): Uint8Array

randomString

  • randomString(length: number, charset?: string, prng?: RandomSource): string
  • Returns uniform random string of the given length with characters from the given charset.

    Charset must not have more than 256 characters.

    Default charset generates case-sensitive alphanumeric strings (0-9, A-Z, a-z).

    Parameters

    • length: number
    • Default value charset: string = ALPHANUMERIC
    • Default value prng: RandomSource = defaultRandomSource

    Returns string

randomStringForEntropy

  • randomStringForEntropy(bits: number, charset?: string, prng?: RandomSource): string
  • Returns uniform random string containing at least the given number of bits of entropy.

    For example, randomStringForEntropy(128) will return a 22-character alphanumeric string, while randomStringForEntropy(128, "0123456789") will return a 39-character numeric string, both will contain at least 128 bits of entropy.

    Default charset generates case-sensitive alphanumeric strings (0-9, A-Z, a-z).

    Parameters

    • bits: number
    • Default value charset: string = ALPHANUMERIC
    • Default value prng: RandomSource = defaultRandomSource

    Returns string

randomUint32

Generated using TypeDoc