rStats.js v1.3.0
    Preparing search index...

    Function rhyper

    • Random numbers from the hypergeometric distribution. Equivalent to R's rhyper().

      Parameters

      • nn: number

        Number of values to generate.

      • m: number

        Number of white balls in the urn.

      • n: number

        Number of black balls in the urn.

      • k: number

        Number of balls drawn from the urn.

      Returns number[]

      An array of nn values (the number of white balls drawn); NaN for invalid parameters.

      setSeed(1);
      rhyper(5, 10, 7, 8); // [5, 5, 5, 3, 6]