RNGenie.Distributions
0.1.0-alpha.2
dotnet add package RNGenie.Distributions --version 0.1.0-alpha.2
NuGet\Install-Package RNGenie.Distributions -Version 0.1.0-alpha.2
<PackageReference Include="RNGenie.Distributions" Version="0.1.0-alpha.2" />
<PackageVersion Include="RNGenie.Distributions" Version="0.1.0-alpha.2" />
<PackageReference Include="RNGenie.Distributions" />
paket add RNGenie.Distributions --version 0.1.0-alpha.2
#r "nuget: RNGenie.Distributions, 0.1.0-alpha.2"
#:package RNGenie.Distributions@0.1.0-alpha.2
#addin nuget:?package=RNGenie.Distributions&version=0.1.0-alpha.2&prerelease
#tool nuget:?package=RNGenie.Distributions&version=0.1.0-alpha.2&prerelease
🎩 RNGenie.Distributions 📈
Lightweight Probability Distributions for Deterministic Sampling
RNGenie.Distributions provides ready-to-use sampling primitives (e.g. Uniform, Triangular, Gaussian-approx)
that integrate with IRandomSource
for reproducible simulations.
✨ Features
- Common distributions (e.g. Uniform, Triangular, Gaussian approximation (using Box-Muller algorithm).
- All samplers implement
IDistribution<T>
→ compose and test easily. - Deterministic when sampled with a seeded
IRandomSource
.
📄 Documentation
See the Distribution Docs for usage and API details.
🚀 Quick Start
Install Core + Distributions:
dotnet add package RNGenie.Core
dotnet add package RNGenie.Distributions
Basic usage:
using RNGenie.Core.Sources;
using RNGenie.Distributions.Continuous;
// Seedable RNG for reproducibility
var rng = new Pcg32Source(seed: 123);
// Sample from a Gaussian-like distribution
var normal = new Gaussian(mean: 0.0, stdDev: 1.0);
double x = normal.Sample(rng);
// Sample from a triangular distribution
var tri = Triangular(min: 0, mode: 10, max: 20);
double y = tri.Sample(rng);
Console.WriteLine($"Normal: {x:F3}, Triangular: {y:F3}");
Output:
Normal: -0.318, Triangular: 12.474
Implement your own distribution:
using RNGenie.Core.Abstractions;
public sealed class Bernoulli : IDistribution<bool>
{
private readonly double _p;
public Bernoulli(double p) => _p = Math.Clamp(p, 0.0, 1.0);
public bool Sample(IRandomSource rng) => rng.NextDouble() < _p;
}
🧩 Extensibility
- Build compound models by sampling multiple distributions.
- Swap RNG sources (
Pcg32Source
,SystemRandomSource
,CryptoRandomSource
) without changing your model code. - Use the same seed to replay experiments exactly.
📦 Roadmap
- Swappable Ziggurat algorithm for Gaussian distributions (currently uses Box-Muller).
- Exponential, Poisson, Gamma, Beta, Binomial samplers.
- Alias method for large discrete distributions.
👩💻 Contributing
Pull requests are welcome!
Good first issues:
- Add new distributions + unit tests
- Numerical validation harness
See CONTRIBUTING.md for guidance. Also, check here for existing distribution issue writeups.
📜 License
RNGenie is licensed under the MIT License. This means you're free to use it in open source, commercial, or personal projects.
Product | Versions 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. |
-
net6.0
- RNGenie.Core (>= 0.1.0-alpha.2)
-
net8.0
- RNGenie.Core (>= 0.1.0-alpha.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
0.1.0-alpha.2 | 45 | 9/13/2025 |
0.1.0-alpha.1 | 147 | 8/31/2025 |