Skip to content

Commit 20a0dcf

Browse files
authored
🤖 Merge PR DefinitelyTyped#75198 [d3-random] Fix randomBinomial definition by @bewuwy
1 parent 6308135 commit 20a0dcf

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

types/d3-random/d3-random-tests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ let prngBinomial: d3Random.RandomBinomial;
141141
prngBinomial = d3Random.randomBinomial;
142142
prngBinomial = d3Random.randomBinomial.source(seedrandom("Schroedinger's flea."));
143143

144-
randomNumberGenerator = prngBinomial(0.5);
144+
randomNumberGenerator = prngBinomial(10, 0.5);
145145

146146
// ------------------------------------------------------------
147147
// randomGamma

types/d3-random/index.d.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,13 @@ export const randomGeometric: RandomGeometric;
191191
*/
192192
export interface RandomBinomial extends RandomNumberGenerationSource {
193193
/**
194-
* Returns a function for generating numbers with a geometric distribution with success probability p.
195-
* The value p is in the range (0, 1].
194+
* Returns a function for generating random numbers with a binomial distribution with n the number of trials and p the success probability.
195+
* The value p is in the range [0, 1].
196196
*
197+
* @param n Number of trials
197198
* @param p Success probability
198199
*/
199-
(p: number): () => number;
200+
(n: number, p: number): () => number;
200201
}
201202

202203
export const randomBinomial: RandomBinomial;

0 commit comments

Comments
 (0)