aboutsummaryrefslogtreecommitdiffstats
path: root/common/utils.go
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2018-07-16 00:12:17 +0800
committerWei-Ning Huang <w@cobinhood.com>2018-07-16 11:06:14 +0800
commitaed24cf020bd11c3b20a7011b96c02e41894fa32 (patch)
tree720bc1542dd1edb7308c124a5265e21b3c01d08b /common/utils.go
downloaddexon-consensus-aed24cf020bd11c3b20a7011b96c02e41894fa32.tar
dexon-consensus-aed24cf020bd11c3b20a7011b96c02e41894fa32.tar.gz
dexon-consensus-aed24cf020bd11c3b20a7011b96c02e41894fa32.tar.bz2
dexon-consensus-aed24cf020bd11c3b20a7011b96c02e41894fa32.tar.lz
dexon-consensus-aed24cf020bd11c3b20a7011b96c02e41894fa32.tar.xz
dexon-consensus-aed24cf020bd11c3b20a7011b96c02e41894fa32.tar.zst
dexon-consensus-aed24cf020bd11c3b20a7011b96c02e41894fa32.zip
Initial implementation of DEXON consensus algorithm
Diffstat (limited to 'common/utils.go')
-rw-r--r--common/utils.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/common/utils.go b/common/utils.go
new file mode 100644
index 0000000..7e89c05
--- /dev/null
+++ b/common/utils.go
@@ -0,0 +1,14 @@
+package common
+
+import (
+ "math/rand"
+)
+
+// NewRandomHash returns a random Hash-like value.
+func NewRandomHash() Hash {
+ x := Hash{}
+ for i := 0; i < HashLength; i++ {
+ x[i] = byte(rand.Int() % 256)
+ }
+ return x
+}