feat(shuffle)!: add Shuffle and ShuffleSlice functions (#11)

Add equivalent to `Shuffle` function from `math/rand` and `math/rand/v2`
packages, but based on randomness from `crypto/rand` package. This
allows cryptographically secure shuffling of data.

Also add `ShuffleSlice` function that shuffles a slice of any type.

BREAKING CHANGE: Minimum required Go version is now 1.18 due the `ShuffleSlice` using generics.
This commit is contained in:
2025-03-10 23:50:25 +00:00
committed by GitHub
parent 312e856234
commit a141938394
10 changed files with 1051 additions and 13 deletions

2
go.mod
View File

@@ -1,6 +1,6 @@
module github.com/jimeh/rands
go 1.17
go 1.18
require github.com/stretchr/testify v1.10.0