RNGenie.Core 0.1.0-alpha.2

This is a prerelease version of RNGenie.Core.
dotnet add package RNGenie.Core --version 0.1.0-alpha.2
                    
NuGet\Install-Package RNGenie.Core -Version 0.1.0-alpha.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="RNGenie.Core" Version="0.1.0-alpha.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RNGenie.Core" Version="0.1.0-alpha.2" />
                    
Directory.Packages.props
<PackageReference Include="RNGenie.Core" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add RNGenie.Core --version 0.1.0-alpha.2
                    
#r "nuget: RNGenie.Core, 0.1.0-alpha.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package RNGenie.Core@0.1.0-alpha.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=RNGenie.Core&version=0.1.0-alpha.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=RNGenie.Core&version=0.1.0-alpha.2&prerelease
                    
Install as a Cake Tool

🎩 RNGenie 🔮

Extensible Randomness Helpers for Games and Simulations

RNGenie is a lightweight C# library that makes randomness in your projects easy, reproducible, and fun. Instead of rewriting weighted picks, dice rollers, or loot tables for every project, just rub the lamp and roll with reproducibility. ✨

NuGet Downloads .NET CI style: editorconfig


✨ Features (per package)

  • RNGenie.Core:
    • Pluggable RNG sources (Pcg32Source, SystemRandomSource, CryptoRandomSource).
    • Abstractions (IRandomSource, IDistribution<T>, reproducibility, branching timelines).
  • RNGenie.Dice → RPG-style dice roller with notation (3d6+2), deterministic when seeded.
  • RNGenie.Cards → deck creation, shuffling, drawing, peeking, deterministic when seeded.
  • RNGenie.Picker → uniform and weighted selection for loot tables, drop rates, and simulations.
  • RNGenie.Distributions → probability distributions (uniform, triangular, normal approximation).
  • (Coming Soon) RNGenie.Json → save/load RNG state, export samples for visualization.

📄 Documentation (per package)


🚀 Quick Start

Install the core package (required):

dotnet add package RNGenie.Core

Install extras as needed (optional):

dotnet add package RNGenie.Dice
dotnet add package RNGenie.Cards
dotnet add package RNGenie.Picker
dotnet add package RNGenie.Distributions

Basic usage:

using RNGenie.Core.Sources;
using RNGenie.Cards;
using RNGenie.Dice;
using RNGenie.Picker;
using RNGenie.Distributions;

// -- RNGenie.Core --

// Seedable RNG for reproducibility
var rng = new Pcg32Source(seed: 123);

// -- RNGenie.Picker --

// Weighted pick
var rarity = new WeightedPicker<string>()
    .Add("Common", 0.75)
    .Add("Rare",   0.20)
    .Add("Epic",   0.05)
    .One(rng);

Console.WriteLine($"You got a {rarity} item!");

// -- RNGenie.Cards --

// Deck creation
var newDeck = new Deck(includeJokers: true);

// Fisher-Yates shuffle, deterministic with seeded RNG source.
newDeck.Shuffle(rng);

Card newCard = newDeck.Draw();

Console.WriteLine($"Card drawn: {newCard}");

// -- RNGenie.Dice --

// Dice roller (explicit + fluent)
var (total, rolls, mod) = DiceRoller.Roll("3d6+2", rng);
Console.WriteLine($"Dice result: {total}");

var crit = rng.Roll("1d20");
Console.WriteLine($"Crit check: {crit.total}");

// -- RNGenie.Distributions --

// Distribution sampling
var normal = new Gaussian(0, 1);
Console.WriteLine($"Normal sample: {normal.Sample(rng):F2}");

Output:

You got a Rare item!
Card drawn: A♠
Dice result: 14
Crit check: 17
Normal sample: -0.13

🧩 Extensibility

RNGenie is built around simple interfaces:

public interface IRandomSource {
    int NextInt(int minInclusive, int maxExclusive);
    double NextDouble(); // [0,1)
    void NextBytes(Span<byte> buffer);
}

public interface IDistribution<T> {
    T Sample(IRandomSource rng);
}

That means you can:

  • Plug in your own RNG algorithm (PCG, XorShift, etc.)
  • Contribute new probability distributions
  • Add new dice mechanics (exploding, keep-highest, etc.)
  • Extend loot tables with custom rules or policies

📦 Roadmap

  • Dice Mechanics: exploding dice (!), advantage/disadvantage (adv/dis).
  • Distributions: Exponential, Poisson, Alias method sampler.
  • Integration: JSON-driven loot tables, Unit/MonoGame samples.
  • Visualization: charts for distributions & loot outcomes.

👩‍💻 Contributing

Pull requests are welcome! Good first issues:

  • Add new dice notations
  • Add new probability distributions
  • Extend loot table policies
    See CONTRIBUTING.md for guidelines.

📜 License

RNGenie is licensed under the MIT License. This means you're free to use it in open source, commercial, or personal projects.


Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on RNGenie.Core:

Package Downloads
RNGenie.Distributions

Probability distributions for RNGenie (continuous and discrete) built on IDistribution<T>. Deterministic with any IRandomSource. Currently includes Uniform, Triangular, Gaussian. Designed to grow.

RNGenie.Dice

Utilities for rolling RPG-style dice expressions (e.g. 3d6+2, 1d20). Built on RNGenie.Core for reproducible results with deterministic RNG sources.

RNGenie.Picker

Utilities for randomly selecting items from collections. Supports uniform and weighted picks (e.g. loot tables, simulations, random encounters). Built on RNGenie.Core for reproducible results with deterministic RNG sources.

RNGenie.Cards

Utilities for creating and manipulating standard playing cards and decks (52 cards + optional jokers). Includes shuffling, drawing, peeking, and resetting with deterministic RNG sources. Built on RNGenie.Core for reproducible, seed-based results.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0-alpha.2 103 9/12/2025
0.1.0-alpha.1 144 8/31/2025