Excellence.Randomizers.Core
2.0.2
Prefix Reserved
See the version list below for details.
dotnet add package Excellence.Randomizers.Core --version 2.0.2
NuGet\Install-Package Excellence.Randomizers.Core -Version 2.0.2
<PackageReference Include="Excellence.Randomizers.Core" Version="2.0.2" />
paket add Excellence.Randomizers.Core --version 2.0.2
#r "nuget: Excellence.Randomizers.Core, 2.0.2"
// Install Excellence.Randomizers.Core as a Cake Addin
#addin nuget:?package=Excellence.Randomizers.Core&version=2.0.2
// Install Excellence.Randomizers.Core as a Cake Tool
#tool nuget:?package=Excellence.Randomizers.Core&version=2.0.2
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 | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. 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 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Newtonsoft.Json (>= 13.0.1)
-
net5.0
- Newtonsoft.Json (>= 13.0.1)
-
net6.0
- Newtonsoft.Json (>= 13.0.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Excellence.Randomizers.Core:
Package | Downloads |
---|---|
Excellence.Randomizers
Default implementation of Randomizers. |
GitHub repositories
This package is not used by any popular GitHub repositories.