random-elements
Advanced tools
Comparing version 0.4.1 to 0.4.2
{ | ||
"name": "random-elements", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"description": "Utility for picking one or more elements from any array", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -28,3 +28,3 @@ # Random Element picker | ||
## Weighted distributions: | ||
Sometimes you want to weight certain outcomes more or less likely than others. This library lets you pass a Map of keys with relative probabilities (weights), and each time you call the function, you will get a single key back but with the probabilities stacked in favour of the ones you weighted higher. | ||
Sometimes you want to weight certain outcomes more or less likely than others. This library lets you pass a [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) of keys with relative probabilities (weights), and each time you call the function, you will get a single key back but with the probabilities stacked in favour of the ones you weighted higher. | ||
@@ -45,3 +45,5 @@ - `pickKeysWithWeights` | ||
// Expect to get "three" roughly twice as often compared to "one" or "two". The chances of getting "three" any given time is 50%, however - that's probability, folks! | ||
// Expect to get "three" roughly twice as often compared to "one" or "two". | ||
// The chances of getting "three" any given time is 50%, however - | ||
// that's probability, folks! | ||
``` | ||
@@ -59,5 +61,6 @@ | ||
// Expect to get "heads" roughly twice as often as "tails". That means 66.6% chance vs 33.3% chance, right? | ||
// Expect to get "heads" roughly twice as often as "tails". That means | ||
// 66.6% chance vs 33.3% chance, right? | ||
``` | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39175
64