Python Weighted Loot Table

A very simple weighted loot table script made in Python.

Get items based on their weight.

This can be used for games or just anything that you want to use a weighted random for.

How it works:

  • This takes in a list of items and weights and chooses a random item based on the weights.
  • Weights are how likely an item is to be picked and are relative.
  • For example, an item with a weight of 10 is 10 times more likely to be picked than a weight of 1 and twice as likely as a weight of 5.
  • You don't have to start your weights at 1; you can start at any positive number.
  • You can edit the loot dictionary to change loot and its weight.
Github
Back
Home