Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • RNG

Index

Constructors

constructor

  • new RNG(seed: number): RNG
  • Create a new random number generator with optional seed. If the provided seed is a function (i.e. Math.random) it will be used as the uniform number generator.

    constructor

    Parameters

    • seed: number

      An arbitrary object used to seed the generator.

    Returns RNG

Methods

exponential

  • exponential(): number
  • Generates numbers using this.uniform().

    Returns number

    Number from the exponential distribution, lambda = 1.

nextByte

  • nextByte(): number
  • Returns number

    Uniform random number between 0 and 255.

normal

  • normal(): number
  • Generates numbers using this.uniform() with the Box-Muller transform.

    Returns number

    Normally-distributed random number of mean 0, variance 1.

poisson

  • poisson(mean: number): number
  • Generates numbers using this.uniform() and Knuth's method.

    Parameters

    • mean: number

    Returns number

    Number from the Poisson distribution.

random

uniform

  • uniform(): number
  • Returns number

    Uniform random number between 0 and 1.

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc