smath 1.15.0 → 1.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -1
- package/package.json +1 -1
- package/types/index.d.ts +3 -1
package/dist/index.js
CHANGED
|
@@ -414,7 +414,9 @@ function selectRandom(stack) {
|
|
|
414
414
|
/**
|
|
415
415
|
* Select a single index in an array at random with different weights.
|
|
416
416
|
* @param weights The weights for each item
|
|
417
|
-
* @returns The index of the randomly selected item
|
|
417
|
+
* @returns The 0-based index of the randomly selected item
|
|
418
|
+
* @example
|
|
419
|
+
* const index = SMath.selectRandomWeighted([3.5, 4, 1]); // 1
|
|
418
420
|
*/
|
|
419
421
|
function selectRandomWeighted(weights) {
|
|
420
422
|
var startWeights = [];
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -244,7 +244,9 @@ export declare function selectRandom<T>(stack: T[]): T;
|
|
|
244
244
|
/**
|
|
245
245
|
* Select a single index in an array at random with different weights.
|
|
246
246
|
* @param weights The weights for each item
|
|
247
|
-
* @returns The index of the randomly selected item
|
|
247
|
+
* @returns The 0-based index of the randomly selected item
|
|
248
|
+
* @example
|
|
249
|
+
* const index = SMath.selectRandomWeighted([3.5, 4, 1]); // 1
|
|
248
250
|
*/
|
|
249
251
|
export declare function selectRandomWeighted(weights: number[]): number;
|
|
250
252
|
/**
|