From 57dc39c4516e5f42e77164babfdcfd84be2d0d2d Mon Sep 17 00:00:00 2001 From: chrislu Date: Wed, 7 Aug 2024 10:41:58 -0700 Subject: randomizing next file handle id --- weed/util/bytes.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'weed/util/bytes.go') 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) -- cgit v1.2.3