summaryrefslogtreecommitdiffstats
path: root/vendor/go.mau.fi/whatsmeow/util/randbytes/randbytes.go
blob: befcd4e9f7570cd26a68322a3d45f2663428ad1a (plain) (blame)
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
}