mirror of
https://github.com/duke-git/lancet.git
synced 2026-02-15 18:22:27 +08:00
fix: return empty byte slice when rand bytes lenght less 1
This commit is contained in:
@@ -39,7 +39,7 @@ func RandInt(min, max int) int {
|
|||||||
// RandBytes generate random byte slice
|
// RandBytes generate random byte slice
|
||||||
func RandBytes(length int) []byte {
|
func RandBytes(length int) []byte {
|
||||||
if length < 1 {
|
if length < 1 {
|
||||||
return nil
|
return []byte{}
|
||||||
}
|
}
|
||||||
b := make([]byte, length)
|
b := make([]byte, length)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user