diff options
| author | hilimd <68371223+hilimd@users.noreply.github.com> | 2020-08-31 18:02:11 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-31 18:02:11 +0800 |
| commit | 44a56b158e4637bd70d3fcf8ddc9107973b60558 (patch) | |
| tree | 4cf59d290d346c6ea06d617531c90d2653f3bc03 /weed/util/bytes.go | |
| parent | b0d6330cf44dbb0664f6ede0dbc82865879dcfe0 (diff) | |
| parent | 408e339c53b9b6626e81f1c3f0f2399494bf4ce6 (diff) | |
| download | seaweedfs-44a56b158e4637bd70d3fcf8ddc9107973b60558.tar.xz seaweedfs-44a56b158e4637bd70d3fcf8ddc9107973b60558.zip | |
Merge pull request #13 from chrislusf/master
sync
Diffstat (limited to 'weed/util/bytes.go')
| -rw-r--r-- | weed/util/bytes.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/weed/util/bytes.go b/weed/util/bytes.go index 890d50586..82e4ddeef 100644 --- a/weed/util/bytes.go +++ b/weed/util/bytes.go @@ -2,6 +2,7 @@ package util import ( "crypto/md5" + "crypto/rand" "encoding/base64" "fmt" "io" @@ -135,3 +136,9 @@ func Base64Md5ToBytes(contentMd5 string) []byte { } return data } + +func RandomInt32() int32 { + buf := make([]byte, 4) + rand.Read(buf) + return int32(BytesToUint32(buf)) +} |
