Back to Lo

Core Samplesby

docs/data/core-samplesby.md

1.53.0199 B
Original Source

Returns N random unique items from a collection, using the provided random index generator.

go
v := lo.SamplesBy(
    []int{10, 20, 30},
    2,
    func(n int) int {
        return 0
    },
)