Skip to content
Snippets Groups Projects
Commit 9778f230 authored by Xavier Perret's avatar Xavier Perret
Browse files

added rand function

parent ab01bb30
No related branches found
No related tags found
1 merge request!2added file to separate client function from the server
...@@ -2,8 +2,11 @@ package utilities ...@@ -2,8 +2,11 @@ package utilities
import ( import (
"fmt" "fmt"
"math/rand"
"net" "net"
. "node/types" . "node/types"
"strconv"
"time"
) )
func PrintTransaction(trans Transaction) { func PrintTransaction(trans Transaction) {
...@@ -115,4 +118,10 @@ func TranslateMessageToTransaction(mess Message) Transaction { ...@@ -115,4 +118,10 @@ func TranslateMessageToTransaction(mess Message) Transaction {
newTrans.Amount = body["amount"].(string) newTrans.Amount = body["amount"].(string)
return newTrans return newTrans
}
func RandomString() string {
r := rand.New(rand.NewSource(time.Now().UnixNano()))
return strconv.Itoa(r.Int())
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment