Files
scandup/pmtools/randhex.go
2022-01-07 20:04:12 +02:00

25 lines
445 B
Go

//
package pmtools
import (
"encoding/hex"
"time"
"math/rand"
)
func RandBytesHex(size int) string {
rand.Seed(time.Now().UnixNano())
randBytes := make([]byte, size)
rand.Read(randBytes)
hexString := hex.EncodeToString(randBytes)
return hexString
}
func RandBytes(size int) []byte {
rand.Seed(time.Now().UnixNano())
randBytes := make([]byte, size)
rand.Read(randBytes)
return randBytes
}
//EOF