@types/d3-random

  • Version 2.2.0
  • Published
  • 15 kB
  • No dependencies
  • MIT license

Install

npm i @types/d3-random
yarn add @types/d3-random
pnpm add @types/d3-random

Overview

TypeScript definitions for D3JS d3-random module

Index

Variables

variable randomBates

const randomBates: RandomBates;

    variable randomBernoulli

    const randomBernoulli: RandomBernoulli;

      variable randomBeta

      const randomBeta: RandomBeta;

        variable randomBinomial

        const randomBinomial: RandomBinomial;

          variable randomCauchy

          const randomCauchy: RandomCauchy;

            variable randomExponential

            const randomExponential: RandomExponential;

              variable randomGamma

              const randomGamma: RandomGamma;

                variable randomGeometric

                const randomGeometric: RandomGeometric;

                  variable randomInt

                  const randomInt: RandomInt;

                    variable randomIrwinHall

                    const randomIrwinHall: RandomIrwinHall;

                      variable randomLogistic

                      const randomLogistic: RandomLogistic;

                        variable randomLogNormal

                        const randomLogNormal: RandomLogNormal;

                          variable randomNormal

                          const randomNormal: RandomNormal;

                            variable randomPareto

                            const randomPareto: RandomPareto;

                              variable randomPoisson

                              const randomPoisson: RandomPoisson;

                                variable randomUniform

                                const randomUniform: RandomUniform;

                                  variable randomWeibull

                                  const randomWeibull: RandomWeibull;

                                    Functions

                                    function randomLcg

                                    randomLcg: (seed?: number) => () => number;
                                    • Returns a linear congruential generator; this function can be called repeatedly to obtain pseudorandom values well-distributed on the interval [0,1) and with a long period (up to 1 billion numbers), similar to Math.random. A seed can be specified as a real number in the interval [0,1) or as any integer. In the latter case, only the lower 32 bits are considered. Two generators instanced with the same seed generate the same sequence, allowing to create reproducible pseudo-random experiments. If the seed is not specified, one is chosen using Math.random.

                                      Parameter seed

                                      A seed that is either a real number in the interval [0,1) or any integer.

                                    Interfaces

                                    interface RandomBates

                                    interface RandomBates extends RandomNumberGenerationSource {}
                                    • A configurable random number generator for the Bates distribution.

                                    call signature

                                    (n: number): () => number;
                                    • Returns a function for generating random numbers with a Bates distribution with n independent variables. The case of fractional n is handled as with d3.randomIrwinHall, and d3.randomBates(0) is equivalent to d3.randomUniform().

                                      Parameter n

                                      Number of independent random variables to use.

                                    interface RandomBernoulli

                                    interface RandomBernoulli extends RandomNumberGenerationSource {}
                                    • A configurable random 0 or 1 generator according to a Bernoulli distribution.

                                    call signature

                                    (p: number): () => number;
                                    • Returns a function for generating either 1 or 0 according to a Bernoulli distribution with 1 being returned with success probability p and 0 with failure probability q = 1 - p. The value p is in the range [0, 1].

                                      Parameter p

                                      p

                                    interface RandomBeta

                                    interface RandomBeta extends RandomNumberGenerationSource {}
                                    • A configurable random number generator with a beta distribution.

                                    call signature

                                    (alpha: number, beta: number): () => number;
                                    • Returns a function for generating random numbers with a beta distribution with alpha and beta shape parameters, which must both be positive.

                                      Parameter alpha

                                      Shape parameter

                                      Parameter beta

                                      Shape paramter

                                    interface RandomBinomial

                                    interface RandomBinomial extends RandomNumberGenerationSource {}
                                    • A configurable random number generator with a binomial distribution.

                                    call signature

                                    (p: number): () => number;
                                    • Returns a function for generating numbers with a geometric distribution with success probability p. The value p is in the range (0, 1].

                                      Parameter p

                                      Success probability

                                    interface RandomCauchy

                                    interface RandomCauchy extends RandomNumberGenerationSource {}
                                    • A configurable random number generator with a Cauchy distribution.

                                    call signature

                                    (a?: number, b?: number): () => number;
                                    • Returns a function for generating random numbers with a Cauchy distribution. a and b have the same meanings and default values as in d3.randomWeibull.

                                      Parameter a

                                      Location parameter

                                      Parameter b

                                      Scale parameter

                                    interface RandomExponential

                                    interface RandomExponential extends RandomNumberGenerationSource {}
                                    • A configurable random number generator for the exponential distribution.

                                    call signature

                                    (lambda: number): () => number;
                                    • Returns a function for generating random numbers with an exponential distribution with the rate lambda; equivalent to time between events in a Poisson process with a mean of 1 / lambda.

                                      Parameter lambda

                                      Expected time between events.

                                    interface RandomGamma

                                    interface RandomGamma extends RandomNumberGenerationSource {}
                                    • A configurable random number generator with a gamma distribution.

                                    call signature

                                    (k: number, theta?: number): () => number;
                                    • Returns a function for generating random numbers with a gamma distribution with k the shape parameter and theta the scale parameter. The value k must be a positive value; if theta is not specified, it defaults to 1.

                                      Parameter k

                                      Shape parameter

                                      Parameter theta

                                      Scale paramter

                                    interface RandomGeometric

                                    interface RandomGeometric extends RandomNumberGenerationSource {}
                                    • A configurable random number generator with a geometric distribution.

                                    call signature

                                    (p: number): () => number;
                                    • Returns a function for generating numbers with a geometric distribution with success probability p. The value p is in the range [0, 1].

                                      Parameter p

                                      Success probability

                                    interface RandomInt

                                    interface RandomInt extends RandomNumberGenerationSource {}
                                    • A configurable random integer generator for the uniform distribution.

                                    call signature

                                    (max: number): () => number;
                                    • Returns a function for generating random integers with a uniform distribution. The minimum allowed value of a returned number is ⌊min⌋ (inclusive), and the maximum is ⌊max - 1⌋ (inclusive) Min defaults to 0.

                                      Parameter max

                                      The maximum allowed value of a returned number.

                                    call signature

                                    (min: number, max: number): () => number;
                                    • Returns a function for generating random integers with a uniform distribution. The minimum allowed value of a returned number is ⌊min⌋ (inclusive), and the maximum is ⌊max - 1⌋ (inclusive)

                                      Parameter min

                                      The minimum allowed value of a returned number.

                                      Parameter max

                                      The maximum allowed value of a returned number.

                                    interface RandomIrwinHall

                                    interface RandomIrwinHall extends RandomNumberGenerationSource {}
                                    • A configurable random number generator for the Irwin–Hall distribution.

                                    call signature

                                    (n: number): () => number;
                                    • Returns a function for generating random numbers with an Irwin–Hall distribution with n independent variables. If the fractional part of n is non-zero, this is treated as adding d3.randomUniform() times that fractional part to the integral part.

                                      Parameter n

                                      Number of independent random variables to use.

                                    interface RandomLogistic

                                    interface RandomLogistic extends RandomNumberGenerationSource {}
                                    • A configurable random number generator with a logistic distribution.

                                    call signature

                                    (a?: number, b?: number): () => number;
                                    • Returns a function for generating random numbers with a logistic distribution. a and b have the same meanings and default values as in d3.randomWeibull.

                                      Parameter a

                                      Location parameter

                                      Parameter b

                                      Scale parameter

                                    interface RandomLogNormal

                                    interface RandomLogNormal extends RandomNumberGenerationSource {}
                                    • A configurable random number generator for the log-normal distribution.

                                    call signature

                                    (mu?: number, sigma?: number): () => number;
                                    • Returns a function for generating random numbers with a log-normal distribution. The expected value of the random variable’s natural logarithm is mu, with the given standard deviation sigma. If mu is not specified, it defaults to 0; if sigma is not specified, it defaults to 1.

                                      Parameter mu

                                      Expected value, defaults to 0.

                                      Parameter sigma

                                      Standard deviation, defaults to 1.

                                    interface RandomNormal

                                    interface RandomNormal extends RandomNumberGenerationSource {}
                                    • A configurable random number generator for the normal (Gaussian) distribution.

                                    call signature

                                    (mu?: number, sigma?: number): () => number;
                                    • Returns a function for generating random numbers with a normal (Gaussian) distribution. The expected value of the generated numbers is mu, with the given standard deviation sigma. If mu is not specified, it defaults to 0; if sigma is not specified, it defaults to 1.

                                      Parameter mu

                                      Expected value, defaults to 0.

                                      Parameter sigma

                                      Standard deviation, defaults to 1.

                                    interface RandomNumberGenerationSource

                                    interface RandomNumberGenerationSource {}

                                      method source

                                      source: (source: () => number) => this;
                                      • Returns the same type of function for generating random numbers but where the given random number generator source is used as the source of randomness instead of Math.random. This is useful when a seeded random number generator is preferable to Math.random.

                                        Parameter source

                                        Source (pseudo-)random number generator implementing the Math.random interface. The given random number generator must implement the same interface as Math.random and only return values in the range [0, 1).

                                      interface RandomPareto

                                      interface RandomPareto extends RandomNumberGenerationSource {}
                                      • A configurable random number generator with an Pareto distribution.

                                      call signature

                                      (alpha: number): () => number;
                                      • Returns a function for generating random numbers with a Pareto distribution with the shape alpha. The value alpha must be a positive value.

                                        Parameter alpha

                                        alpha

                                      interface RandomPoisson

                                      interface RandomPoisson extends RandomNumberGenerationSource {}
                                      • A configurable random number generator with a Poisson distribution.

                                      call signature

                                      (lambda: number): () => number;
                                      • Returns a function for generating random numbers with a Poisson distribution with mean lambda.

                                        Parameter lambda

                                        Mean

                                      interface RandomUniform

                                      interface RandomUniform extends RandomNumberGenerationSource {}
                                      • A configurable random number generator for the uniform distribution.

                                      call signature

                                      (max?: number): () => number;
                                      • Returns a function for generating random numbers with a uniform distribution. The minimum allowed value of a returned number is min (inclusive), and the maximum is max (exclusive). Min defaults to 0; if max is not specified, it defaults to 1.

                                        Parameter max

                                        The maximum allowed value of a returned number, defaults to 1.

                                      call signature

                                      (min: number, max: number): () => number;
                                      • Returns a function for generating random numbers with a uniform distribution. The minimum allowed value of a returned number is min (inclusive), and the maximum is max (exclusive).

                                        Parameter min

                                        The minimum allowed value of a returned number.

                                        Parameter max

                                        The maximum allowed value of a returned number.

                                      interface RandomWeibull

                                      interface RandomWeibull extends RandomNumberGenerationSource {}
                                      • A configurable random number generator with one of the generalized extreme value distributions.

                                      call signature

                                      (k: number, a?: number, b?: number): () => number;
                                      • Returns a function for generating random numbers with one of the generalized extreme value distributions, depending on k: If k is positive, the Weibull distribution with shape parameter k If k is zero, the Gumbel distribution If k is negative, the Fréchet distribution with shape parameter −k In all three cases, a is the location parameter and b is the scale parameter. If a is not specified, it defaults to 0; if b is not specified, it defaults to 1.

                                        Parameter k

                                        Shape parameter

                                        Parameter a

                                        Location parameter

                                        Parameter b

                                        Scale parameter

                                      Package Files (1)

                                      Dependencies (0)

                                      No dependencies.

                                      Dev Dependencies (0)

                                      No dev dependencies.

                                      Peer Dependencies (0)

                                      No peer dependencies.

                                      Badge

                                      To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                      You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/d3-random.

                                      • Markdown
                                        [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/d3-random)
                                      • HTML
                                        <a href="https://www.jsdocs.io/package/@types/d3-random"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>