Skip to content

ruudschouten/ExtraRandom.NET

Repository files navigation

ExtraRandom

NuGet Version NuGet Version NuGet Version

This is a library which adds a few random-related functionalities. These are divided across several projects.

ExtraRandom

This project contains the main random number generators;

  • Psuedo random number generators
  • Psuedo random index generators
  • Specialised random number generators
    • BiasedRandom
      • Rolls multiple times for a single result and picks the value that was closest to the set bias.
    • Weighted
      • Assigns weights to all entries, which influence the likeliness of the entry being chosen when rolling.

ExtraShuffle

This project contains shuffle algorithms which are added as extension methods to IList<T>.

There are two ways to call these;

  1. Using a for or foreach loop with the iterator method; list.FaroShuffleIterator(min, max)
  2. Calling the method directly; list.FaroShuffle()

ExtraSort

This project was added because the WeightedRandom required a sorted list of weights, and I thought it would be fun to add a few sorting algorithms it could use instead of the OrderBy LINQ method.

The sorts added now are;

  • Binary Insertion Sort
  • Insertion Sort
  • Merge Sort
  • Tim Sort
  • Power Sort
  • Peek Sort

These are added using a Sort extension method for IList<T>, in which a instance of ISortAlgorithm must be passed. This instance is then used to sort the current list.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages