Skip to content

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

Notifications You must be signed in to change notification settings

girng/RNGIterator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 

Repository files navigation

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!

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published