1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-04 12:52:28 +08:00

fix: return empty byte slice when rand bytes lenght less 1

This commit is contained in:
dudaodong
2022-01-09 14:00:23 +08:00
parent 65719515bd
commit 25b2ae6b98

View File

@@ -39,7 +39,7 @@ func RandInt(min, max int) int {
// RandBytes generate random byte slice
func RandBytes(length int) []byte {
if length < 1 {
return nil
return []byte{}
}
b := make([]byte, length)