JavaScript / Node.js tutorial for Pick Weighted. This video includes code walkthrough, description, usage, and examples for the function Pick Weighted. Pick Weighted chooses a single item from an array randomly. The twist is, instead of all items having uniform probability, they are all given custom weights. Items with higher weights are more likely to be picked. The values of weights are relative. Having two items, one with a weight of 1 and the other with 9, is the same as with 10 and 90. In other words, an item, which has a weight that is 10% of the grand total of all weights, will have 10% chance to be picked. Happy coding! Fonts: Fira Code, Rubik Mono One, Shippori Mincho Music: Smooth Meditation by Arulo (CC0)
JavaScript / Node.js tutorial for Pick Weighted. This video includes code walkthrough, description, usage, and examples for the function Pick Weighted. Pick Weighted chooses a single item from an array randomly. The twist is, instead of all items having uniform probability, they are all given custom weights. Items with higher weights are more likely to be picked. The values of weights are relative. Having two items, one with a weight of 1 and the other with 9, is the same as with 10 and 90. In other words, an item, which has a weight that is 10% of the grand total of all weights, will have 10% chance to be picked. Happy coding! Fonts: Fira Code, Rubik Mono One, Shippori Mincho Music: Smooth Meditation by Arulo (CC0)