An open API service indexing awesome lists of open source software.

https://github.com/kaleidawave/randomizer

A randomizer made in C# for choosing a random item with a weighted chance
https://github.com/kaleidawave/randomizer

csharp generic-types

Last synced: 12 months ago
JSON representation

A randomizer made in C# for choosing a random item with a weighted chance

Awesome Lists containing this project

README

          

Randomizer

A randomizer made in C# for choosing a random item with a weighted chance

Usage:

```cs
using Randomizer;

// Create an object that inherits the 'IWeighted' inheritance with the 'Weight' property
struct Reward: IWeighted
{
int Weight { get; set; }
...
}

// Past a list of objects into the constructor
List foo = ...
Randomizer bar = new Randomizer(foo);

// Retrieve results!!!
Reward x = bar.Pick();
```