Add two generic functions, analog to to RandomStringMapKey and RandomStringMapValue, in the same way RandomElement is to RandomStringElement.
This was something I felt was missing as I was trying to get a random map element from a map than was not a map[string]string.
Unlike their String counterpart though, no sorting is performed. Doing a sort would require the generics to be constrained to cmd.Ordered which I feel is too restrictive.
Are you trying to fix an existing issue?
No
Go Version
$ go version
go version go1.23.2 darwin/arm64
Go Tests
$ go test
PASS
ok github.com/jaswdr/faker/v2 7.547s
Description
Add two generic functions, analog to to RandomStringMapKey and RandomStringMapValue, in the same way RandomElement is to RandomStringElement.
This was something I felt was missing as I was trying to get a random map element from a map than was not a
map[string]string
.Unlike their String counterpart though, no sorting is performed. Doing a sort would require the generics to be constrained to
cmd.Ordered
which I feel is too restrictive.Are you trying to fix an existing issue?
No
Go Version
Go Tests