summaryrefslogtreecommitdiff
path: root/pkg/scrypto/random.go
blob: 47d9557da477aa565c58674b74a4d0addd2fe6e6 (plain)
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
}