repl.txt (2845B)
1 2 {{alias}}( N, K, n[, options] ) 3 Returns an iterator for generating pseudorandom numbers drawn from a 4 hypergeometric distribution. 5 6 If an environment supports Symbol.iterator, the returned iterator is 7 iterable. 8 9 `N`, `K`, and `n` must all be nonnegative integers; otherwise, the function 10 throws an error. 11 12 If `n > N` or `K > N`, the function throws an error. 13 14 Parameters 15 ---------- 16 N: integer 17 Population size. 18 19 K: integer 20 Subpopulation size. 21 22 n: integer 23 Number of draws. 24 25 options: Object (optional) 26 Options. 27 28 options.prng: Function (optional) 29 Pseudorandom number generator (PRNG) for generating uniformly 30 distributed pseudorandom numbers on the interval `[0,1)`. If provided, 31 the `state` and `seed` options are ignored. In order to seed the 32 returned iterator, one must seed the provided `prng` (assuming the 33 provided `prng` is seedable). 34 35 options.seed: integer|ArrayLikeObject<integer> (optional) 36 Pseudorandom number generator seed. The seed may be either a positive 37 unsigned 32-bit integer or, for arbitrary length seeds, an array-like 38 object containing unsigned 32-bit integers. 39 40 options.state: Uint32Array (optional) 41 Pseudorandom number generator state. If provided, the `seed` option is 42 ignored. 43 44 options.copy: boolean (optional) 45 Boolean indicating whether to copy a provided pseudorandom number 46 generator state. Setting this option to `false` allows sharing state 47 between two or more pseudorandom number generators. Setting this option 48 to `true` ensures that a returned iterator has exclusive control over 49 its internal state. Default: true. 50 51 options.iter: integer (optional) 52 Number of iterations. 53 54 Returns 55 ------- 56 iterator: Object 57 Iterator. 58 59 iterator.next(): Function 60 Returns an iterator protocol-compliant object containing the next 61 iterated value (if one exists) and a boolean flag indicating whether the 62 iterator is finished. 63 64 iterator.return( [value] ): Function 65 Finishes an iterator and returns a provided value. 66 67 iterator.PRNG: Function 68 Underlying pseudorandom number generator. 69 70 iterator.seed: Uint32Array|null 71 Pseudorandom number generator seed. 72 73 iterator.seedLength: integer|null 74 Length of generator seed. 75 76 iterator.state: Uint32Array|null 77 Generator state. 78 79 iterator.stateLength: integer|null 80 Length of generator state. 81 82 iterator.byteLength: integer|null 83 Size (in bytes) of generator state. 84 85 Examples 86 -------- 87 > var it = {{alias}}( 20, 10, 7 ); 88 > var r = it.next().value 89 <number> 90 > r = it.next().value 91 <number> 92 93 See Also 94 -------- 95