Skip to content

Commit

Permalink
Update src/modules/helpers/index.ts
Browse files Browse the repository at this point in the history
Co-authored-by: Shinigami <[email protected]>
  • Loading branch information
Matt Mayer and Shinigami92 authored Dec 29, 2022
1 parent 309e2af commit 3cc43ca
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/modules/helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,10 @@ export class HelpersModule {

/**
* Returns a weighted random element from the given array. Each element of the array should be an object with two keys `weight` and `value`.
* Each `weight` key should be a number representing the probability of selecting the value, relative to the sum of the weights. Weights can be any positive float or integer.
* Each `value` key should be the corresponding value.
*
* - Each `weight` key should be a number representing the probability of selecting the value, relative to the sum of the weights. Weights can be any positive float or integer.
* - Each `value` key should be the corresponding value.
*
* For example, if there are two values A and B, with weights 1 and 2 respectively, then the probability of picking A is 1/3 and the probability of picking B is 2/3.
*
* @template T The type of the entries to pick from.
Expand Down

0 comments on commit 3cc43ca

Please sign in to comment.