API Reference › List › List.sample
method

List.sample

List.sample(pool, count) -> []int

Returns count picks from an []int, drawn from the seeded RNG. Picks are distinct while the pool has enough elements; with fewer, the spare picks repeat a valid element. An empty pool yields zeros. A relic offer, a loot roll, a random enemy roster.

Example

# doc-check: skip — illustrative
relic_offer = List.sample(Relics.unowned(), 3)
← All symbols