This is a library which adds a few random-related functionalities. These are divided across several projects.
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.
- BiasedRandom
This project contains shuffle algorithms which are added as extension methods to IList<T>.
There are two ways to call these;
- Using a for or foreach loop with the iterator method;
list.FaroShuffleIterator(min, max) - Calling the method directly;
list.FaroShuffle()
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.