Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

add weighted random package #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cebarks
Copy link
Contributor

@cebarks cebarks commented Jun 21, 2021

adds a new package which implements a WeightedRandom struct.

Would be useful for drop tables or other game mechanics where the chances for each option aren't equal.

@dusk125
Copy link
Owner

dusk125 commented Jun 22, 2021

Since total is a constant value after the weighted random creation, could you calculate and store it in the New function instead of recalculating it in every call to Get?

@dusk125
Copy link
Owner

dusk125 commented Jun 22, 2021

Oh also, would you add a change to the readme adding a blurb about this new package please?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants