1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
package scrypto import ( "crypto/rand" "fmt" ) func RandomBytes(n int) []byte { data := make([]byte, n) if _, err := rand.Read(data); err != nil { panic(fmt.Sprintf("cannot generate random data: %+v", err)) } return data }