mirror of
https://github.com/duke-git/lancet.git
synced 2026-02-04 21:02: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
|
||||
func RandBytes(length int) []byte {
|
||||
if length < 1 {
|
||||
return nil
|
||||
return []byte{}
|
||||
}
|
||||
b := make([]byte, length)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user