From 5ee3f57dfff946709c5e5b13f83d5e4133a9bcf4 Mon Sep 17 00:00:00 2001 From: itchyny Date: Fri, 8 Jan 2021 20:09:10 +0900 Subject: [PATCH] initialize seed of the global random generator using unix timestamp The algorithm for generating temporary paths is not cryptographically safe, but this is enough in real situation. --- cmd/mmv/main.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/mmv/main.go b/cmd/mmv/main.go index 30e1e61..889be59 100644 --- a/cmd/mmv/main.go +++ b/cmd/mmv/main.go @@ -5,10 +5,12 @@ import ( "flag" "fmt" "io/ioutil" + "math/rand" "os" "os/exec" "runtime" "strings" + "time" _ "github.com/mattn/getwild" "github.com/mattn/go-tty" @@ -22,6 +24,10 @@ const version = "0.1.2" var revision = "HEAD" +func init() { + rand.Seed(time.Now().UnixNano()) +} + func main() { os.Exit(run(os.Args[1:])) }