Files

17 lines
378 B
Go
Raw Permalink Normal View History

// Copyright (C) 2020-2026, Lux Industries Inc. All rights reserved.
2025-07-25 20:12:57 -05:00
// See the file LICENSE for licensing terms.
package crypto
import (
"crypto/rand"
)
// RandomBytes returns a slice of n random bytes from crypto/rand.
// In Go 1.26+, crypto/rand.Read always succeeds or panics.
2025-07-25 20:12:57 -05:00
func RandomBytes(n int) []byte {
bytes := make([]byte, n)
rand.Read(bytes)
2025-07-25 20:12:57 -05:00
return bytes
}