PickHistory
PickHistory stores the recent picks made by a ProbabilityList<T>. It is the small helper type behind convenience properties such as LastPickedIndex, LastPickedValues, and other history-related APIs on the list itself.
Each history entry records:
- the picked item index
- the time of the pick
Core members
History access
HistoryThe underlying list of history entries.
CapacityMaximum number of entries to retain. Minimum value is 1.
LatestIndexIndex of the most recent pick, or -1 if history is empty.
LatestEntryThe most recent history entry, or null when history is empty.
Retrieval helpers
Retrieval methods
GetLatestEntriesReturns a shared list containing the newest history entries.
GetLatestEntriesFills your own list with the newest entries.
GetLatestPicksReturns a shared list of the latest picked item indices.
GetLatestPicksFills your own list with the latest picked indices.
Mutation helpers
Mutation methods
ClearHistoryRemoves all history entries and returns them to the pool.
AddEntryAdds one picked index to history.
AddEntriesAdds multiple picks to history in one operation.
Some retrieval helpers return shared lists.
That avoids extra allocations. If you need a stable copy, pass in your own list and fill that instead.
History entries are pooled.
RNGNeeds reuses HistoryEntry objects to reduce garbage creation. You can pre-warm the pool via RNGNeedsCore.WarmupHistoryEntries(...) if needed.