Open lil5 opened 2 years ago
Is your feature request related to a problem? Please describe. I'm trying to fake a randomized array of unique enums
Describe the solution you'd like To include shuffleSlice as Faker.ShuffleSlice
shuffleSlice
func ShuffleSlice[T any](slice []T) []T { rand.Shuffle(len(slice), func(i, j int) { slice[i], slice[j] = slice[j], slice[i] }) return slice }
go playground example https://play.golang.com/p/1rQ2O-0aNOx
Hello @lil5, unfortunately it is not possible to use Generics because we still support versions <= 1.18. I'll add this issue to our go1.18 migration plan. I'll include this idea when we bump our Go version.
Is your feature request related to a problem? Please describe. I'm trying to fake a randomized array of unique enums
Describe the solution you'd like To include
shuffleSlice
as Faker.ShuffleSlicego playground example https://play.golang.com/p/1rQ2O-0aNOx