Commits

Cédric Bonhomme  committed eacd788

Use random.Sedd() with time.UnixNano().

  • Participants
  • Parent commits b524837

Comments (0)

Files changed (1)

         "io/ioutil"
         "encoding/xml"
         "math/rand"
+        "time"
 )
 
 type Quotes struct {
 
     // Get the number of quotes
     nb_quotes := len(quotes.Quote)
-    quote := rand.Intn(nb_quotes+1)
+    rand.Seed(time.Now().UnixNano())
+    quote := rand.Intn(nb_quotes)
 
     // now use the person structure e.g.
     fmt.Println("Citation: \"" + quotes.Quote[quote].Citation + "\"")