Skip to content

Latest commit

 

History

History
20 lines (12 loc) · 1.03 KB

README.md

File metadata and controls

20 lines (12 loc) · 1.03 KB

RNGIterator

Calculates the amount of iterations needed for a chance to be true in Crystal.

Iterations can help a developer when brainstorming and implementing certain game mechanics. Some examples: what to do after a monster was killed, the chance of an item applying a modifier based on chance on another item, on kill chances, on hit chances, chance for an item to drop, chance of an entity appearing in a generated map, etc. The developer having a general estimate of how many iterations are required for certain things can be very powerful.

The closer a developer understands randomness, the better our lives will become. I hope this helps!

Usage

  • crystal RNGIterator.cr --release
  • You can modify the 2 parameters (chance, times) to your liking.
  • For example, a 1% chance of something happening:

Contribution

Feel free to contribute to make this script better! All PRs are welcome.

Thanks for stopping by, and have a wonderful day!