aboutsummaryrefslogtreecommitdiff
path: root/weed/util/randomizer.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2019-01-28 11:55:33 -0800
committerChris Lu <chris.lu@gmail.com>2019-01-28 11:55:33 -0800
commit6230eb28a61e289eeb2eb7ef579c7d1716cbc016 (patch)
tree47f38c4c5ed58ab50c15964cb78028471a6da947 /weed/util/randomizer.go
parent221105eea3cb2cfb587870df0fe0e62c640c4b99 (diff)
downloadseaweedfs-6230eb28a61e289eeb2eb7ef579c7d1716cbc016.tar.xz
seaweedfs-6230eb28a61e289eeb2eb7ef579c7d1716cbc016.zip
randomize based on self address
fix #851
Diffstat (limited to 'weed/util/randomizer.go')
-rw-r--r--weed/util/randomizer.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/weed/util/randomizer.go b/weed/util/randomizer.go
new file mode 100644
index 000000000..e5ccd3fb3
--- /dev/null
+++ b/weed/util/randomizer.go
@@ -0,0 +1,9 @@
+package util
+
+import "hash/fnv"
+
+func HashBytesToInt64(x []byte) int64 {
+ hash := fnv.New64()
+ hash.Write(x)
+ return int64(hash.Sum64())
+}