package generator import ( "errors" "pgregory.net/rapid" ) // Error returns a new error created by calling [errors.New] with a random string. func Error() *rapid.Generator[error] { return rapid.Map(rapid.String(), errors.New) } // SliceOfNZero returns a generator that makes slices of the zero value of T. // The range of slice lengths are determined as in [rapid.SliceOfN]. func SliceOfNZero[T any](minLen, maxLen int) *rapid.Generator[[]T] { return rapid.Map(rapid.IntRange(minLen, maxLen), func(n int) []T { return make([]T, n) }) }