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
- Host: GitHub
- URL: https://github.com/kaleidawave/randomizer
- Owner: kaleidawave
- License: mit
- Created: 2019-04-24T16:59:52.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-04-24T19:28:12.000Z (about 7 years ago)
- Last Synced: 2025-03-23T02:27:36.351Z (over 1 year ago)
- Topics: csharp, generic-types
- Language: C#
- Homepage:
- Size: 1.95 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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();
```