Enum RepeatPreventionMode
Specifies how ProbabilityList<T> handles repeated consecutive selections of the same entry.
Namespace: Scylla.Core.Util.Random
Assembly: ScyllaCore.dll
Syntax
public enum RepeatPreventionMode
Remarks
Each mode represents a different trade-off between distribution accuracy, implementation cost, and the strength of the repeat-avoidance guarantee:
- Off - no overhead; highest variance.
- Spread - one extra linear scan on repeat; distribution is slightly biased because the repeated entry's probability is zeroed.
- Repick - bounded retries; distribution stays correct but retries add variable cost proportional to the entry's probability.
- Shuffle - O(n) deck build amortized over many picks; perfect distribution over full cycles, no history required during play.
Changing RepeatPrevention at runtime resets all shuffle state, so the next pick will deal from a freshly built deck if Shuffle is selected.
Fields
| Name | Description |
|---|---|
| Off | Disables repeat prevention entirely. The same entry may be selected on consecutive picks according to its natural probability. Requires no history tracking and adds no overhead to the selection path. |
| Repick | Discards and re-samples when the same entry is picked consecutively, retrying up to
|
| Shuffle | Pre-shuffles a weighted deck of all active entries and deals from it sequentially. When the deck is exhausted, a new deck is built and shuffled. The number of passes through the same shuffled deck before reshuffling is controlled by ShuffleIterations. |
| Spread | Prevents an immediate repeat by zeroing the most recently picked entry's probability and re-sampling from the remaining entries when a repeat is detected. The remaining entries are sampled proportionally so their relative weights are preserved. |