1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
package randbytes import ( "crypto/rand" "fmt" ) func Make(length int) []byte { random := make([]byte, length) _, err := rand.Read(random) if err != nil { panic(fmt.Errorf("failed to get random bytes: %w", err)) } return random }