Fluent-Random-Picker
Fluent-Random-Picker copied to clipboard
Fluent Random Picker is a nice, performant, fluent way to pick random values. Probabilities can be specified, values can be weighted.
**What's possible in this case:** - Out.Of().Values(...).AndValues(...).AndValues(...)... - Out.Of().Values(...).WithWeigts(...).AndValues(...).WithWeigts(...)... **What's not possible in this case:** - Out.Of().Values(...).WithWeigts(...).AndValues(...).Pick(...); - Out.Of().Values(...).AndValues(...).WithWeigts(...).Pick(...); **What about percentages?** Do all of them sum of to 100...
There are [multiple enumerations](https://www.jetbrains.com/help/resharper/PossibleMultipleEnumeration.html) of IEnumerables in the code. Count() is probably also calculated more often than necessary. FluentRandomPicker should work with Collections/Lists **internally**. The IEnumerable that the user passes...
Question: **How to pick values with different priorities prioritized?** The current implementation works with stochastic acceptance and runs in linear time on average (see [StochasticAcceptanceBasedWeightedLeftShuffle.cs)](https://github.com/ndsvw/Fluent-Random-Picker/blob/main/FluentRandomPicker/Shuffle/StochasticAcceptanceBasedWeightedLeftShuffle.cs) Problem: The max probability value...
Descriptions for classes/methods/... are intended to give the user of the library additional/useful information.
- How much effort is it? - is it worth it? - does the project name "Fluent-Random-Picker" still make sense? - Can extension methods for all this be built without...
Bumps [StyleCop.Analyzers](https://github.com/DotNetAnalyzers/StyleCopAnalyzers) from 1.2.0-beta.507 to 1.2.0-beta.556. Release notes Sourced from StyleCop.Analyzers's releases. 1.2.0-beta.556 What's Changed Update SA1011 to forbid trailing space before the end of a switch case by @bjornhellander...
Bumps [BenchmarkDotNet](https://github.com/dotnet/BenchmarkDotNet) from 0.13.11 to 0.13.12. Release notes Sourced from BenchmarkDotNet's releases. 0.13.12 Full changelog: https://benchmarkdotnet.org/changelog/v0.13.12.html Highlights The biggest highlight of this release if our new VSTest Adapter, which allows...
https://en.wikipedia.org/wiki/Reservoir_sampling#Optimal:_Algorithm_L https://www.geeksforgeeks.org/select-a-random-number-from-stream-with-o1-space/?ref=lbp https://www.geeksforgeeks.org/reservoir-sampling/
`Out.Of().Values(Span / ReadonlySpan / Memory / ReadOnlyMemory)`