Excellence.Randomizers.Core 4.0.0

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
dotnet add package Excellence.Randomizers.Core --version 4.0.0
NuGet\Install-Package Excellence.Randomizers.Core -Version 4.0.0
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="Excellence.Randomizers.Core" Version="4.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Excellence.Randomizers.Core --version 4.0.0
#r "nuget: Excellence.Randomizers.Core, 4.0.0"
#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.
// Install Excellence.Randomizers.Core as a Cake Addin
#addin nuget:?package=Excellence.Randomizers.Core&version=4.0.0

// Install Excellence.Randomizers.Core as a Cake Tool
#tool nuget:?package=Excellence.Randomizers.Core&version=4.0.0

Randomizers

Table of contents

<br/>

Overview

Randomizers are used to create the set of items randomly selected and then shuffled from a provided collection of items.

Every randomizer use configurations to create the resulting set.

A configuration defines the rules that are used by a randomizer.

<br />

Configurations

Randomizer should have configurations added to create the resulting sets.

Configurations are created using default constructor. Then configuration methods define the rules.

Example:

var configuration = new Configuration<int>();
configuration.UseItems(1, 2, 3);
configuration.UseMinCount(2);
configuration.UseMaxCount(10);
configuration.UseUnique(false);

// or

var configuration2 = new Configuration<int>()
    .UseItems(new List<int>() { 3, 4, 5, 6, 7, 8 })
    .UseMinCount(1)
    .UseMaxCount(5)
    .UseUnique(true);

// or

var configuration3 = new Configuration<int>()
    .UseFromJson
    (
        "{ "
        + "\"Items\": [1, 3, 5, 7, 9], "
        + "\"MinCount\": 2, "
        + "\"MaxCount\": 4, "
        + "\"UniqueOnly\": false"
        + " }"
    );

<br/>

Randomizers

When configurations are ready a randomizer can create shuffled sets of randomly selected items.

<br/>

Create a randomizer

Randomizers can be created using the IRandomizerFactory.

Example:

var randomGenerator = new DefaultRandomGenerator();
var shuffler = new KnuthShuffler(randomGenerator);

var randomizerFactory = new RandomizerFactory(randomGenerator, shuffler);

var randomizer = randomizerFactory.CreateRandomizer<int>();

<br/>

Add configurations

Configurations are added using Use methods.

Every configuration defines its own rules so the randomizer generates the resulting sets that match the rules of every configuration.

Example:

randomizer.Use(configuration);

// or

randomizer.Use(new List<IConfiguration<int>>() { configuration2, configuration3 });

<br/>

Create resulting sets

Next methods create the resulting sets.

Example:

// one set
var randomSet = randomizer.Next();

// 5 sets
var randomSets = randomizer.Next(5);

<br/>

Copy

Copy copies the randomizers with all configurations and returns a new randomizer instance. Instances are independent and adding configuration to one randomizer does not affect another one.

Example:

var randomizerCopy = randomizer.Copy()
                .Use(configuration3.Copy());

var anotherRandomSet = randomizerCopy.Next();
var anotherRandomSets = randomizerCopy.Next(5);

<br/>

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 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Excellence.Randomizers.Core:

Package Downloads
Excellence.Randomizers The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

Default implementation of Randomizers.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
4.0.0 305 12/9/2023
3.0.0 504 11/12/2022
2.0.2 863 9/18/2022
2.0.1 866 9/18/2022
2.0.0 877 6/21/2022
1.0.0 880 5/21/2022