d20tek-dicenotation-mathnet 5.2.1

dotnet add package d20tek-dicenotation-mathnet --version 5.2.1
                    
NuGet\Install-Package d20tek-dicenotation-mathnet -Version 5.2.1
                    
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="d20tek-dicenotation-mathnet" Version="5.2.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="d20tek-dicenotation-mathnet" Version="5.2.1" />
                    
Directory.Packages.props
<PackageReference Include="d20tek-dicenotation-mathnet" />
                    
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 d20tek-dicenotation-mathnet --version 5.2.1
                    
#r "nuget: d20tek-dicenotation-mathnet, 5.2.1"
                    
#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 d20tek-dicenotation-mathnet@5.2.1
                    
#: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=d20tek-dicenotation-mathnet&version=5.2.1
                    
Install as a Cake Addin
#tool nuget:?package=d20tek-dicenotation-mathnet&version=5.2.1
                    
Install as a Cake Tool

d20Tek DiceNotation Math.NET Die Roller

Adds a die roller for the d20Tek.DiceNotation library that uses Math.NET Numerics random sources. It lives in its own package so that applications that don't need it don't take on the Math.NET Numerics dependency.

Install

dotnet add package d20tek-dicenotation-mathnet

Roll with a Math.NET random source

IDice dice = new Dice();

// Mersenne Twister by default; pass any Math.NET RandomSource to the constructor to use another one.
DiceResult result = dice.Roll("4d6k3", new MathNetDieRoller());

A seeded roller produces a reproducible sequence and exposes a ReplayToken:

var roller = new MathNetDieRoller(seed: 12345);
ReplayToken token = roller.ReplayToken!;

Dependency injection

services.AddDiceNotation(options => options.UseMathNetDieRoller());

// Or a seeded, replayable roller.
services.AddDiceNotation(options => options.UseSeededMathNetDieRoller(12345));

Replaying Math.NET tokens

Replaying a MathNetMersenneTwister token needs this package's provider:

// With dependency injection.
services.AddDiceNotation(options => options
    .AddMathNetSeededDieRollerProvider()
    .UseReplayDieRoller(token));

// Without dependency injection.
var replayed = DieRollerFactory.CreateFromReplayToken(token, null, [new MathNetSeededDieRollerProvider()]);
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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 is compatible.  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.

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
5.2.1 85 11/22/2026

Current release:
     * MathNetDieRoller moved here from the d20tek-dicenotation package.
     * UseMathNetDieRoller and UseSeededMathNetDieRoller builder extensions.
     * MathNetSeededDieRollerProvider and AddMathNetSeededDieRollerProvider for replaying MathNet tokens.