aboutsummaryrefslogtreecommitdiff
path: root/weed/util/bytes.go
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2024-08-07 10:41:58 -0700
committerchrislu <chris.lu@gmail.com>2024-08-07 10:42:00 -0700
commit57dc39c4516e5f42e77164babfdcfd84be2d0d2d (patch)
treec62ee8f6a2d3bbd4cd16769240abe6184c9ae530 /weed/util/bytes.go
parent3e6ca6e7065a84f1a0a2a142358ac0c2fc0e9b48 (diff)
downloadseaweedfs-57dc39c4516e5f42e77164babfdcfd84be2d0d2d.tar.xz
seaweedfs-57dc39c4516e5f42e77164babfdcfd84be2d0d2d.zip
randomizing next file handle id
Diffstat (limited to 'weed/util/bytes.go')
-rw-r--r--weed/util/bytes.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/weed/util/bytes.go b/weed/util/bytes.go
index 26da91033..482dc3a48 100644
--- a/weed/util/bytes.go
+++ b/weed/util/bytes.go
@@ -148,6 +148,12 @@ func RandomInt32() int32 {
return int32(BytesToUint32(buf))
}
+func RandomUint64() int32 {
+ buf := make([]byte, 8)
+ rand.Read(buf)
+ return int32(BytesToUint64(buf))
+}
+
func RandomBytes(byteCount int) []byte {
buf := make([]byte, byteCount)
rand.Read(buf)