From 9778f230a1f8c0710c7ce818973d2473f1e98e19 Mon Sep 17 00:00:00 2001 From: Xavier Perret <xa.perret@outlook.com> Date: Sun, 30 Oct 2022 14:54:42 +0100 Subject: [PATCH] added rand function --- app/utilities/utilities.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/utilities/utilities.go b/app/utilities/utilities.go index 2360334..3607d3e 100644 --- a/app/utilities/utilities.go +++ b/app/utilities/utilities.go @@ -2,8 +2,11 @@ package utilities import ( "fmt" + "math/rand" "net" . "node/types" + "strconv" + "time" ) func PrintTransaction(trans Transaction) { @@ -115,4 +118,10 @@ func TranslateMessageToTransaction(mess Message) Transaction { newTrans.Amount = body["amount"].(string) return newTrans -} \ No newline at end of file + +} + +func RandomString() string { + r := rand.New(rand.NewSource(time.Now().UnixNano())) + return strconv.Itoa(r.Int()) +} -- GitLab