Skip to content

Commit 982ee00

Browse files
committed
Allow slice subtypes in ShuffleSlice
1 parent 7405d30 commit 982ee00

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

ffrand/random.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ func Shuffle(n int, swap func(i, j int)) {
205205
// Implements the Fisher-Yates shuffle algorithm.
206206
//
207207
// Uses the default [Rand].
208-
func ShuffleSlice[E any](slice []E) {
208+
func ShuffleSlice[E any, S ~[]E](slice S) {
209209
for i := len(slice) - 1; i > 0; i = i - 1 {
210210
j := Intn(i + 1)
211211
slice[i], slice[j] = slice[j], slice[i]

0 commit comments

Comments
 (0)