summaryrefslogtreecommitdiff
path: root/theo.go
diff options
context:
space:
mode:
Diffstat (limited to 'theo.go')
-rw-r--r--theo.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/theo.go b/theo.go
index b0e7d95..6b455d0 100644
--- a/theo.go
+++ b/theo.go
@@ -11,7 +11,8 @@ import (
"time"
)
-var talk = []string{
+// Talk contains known quotes
+var Talk = []string{
`Write more code.`,
`Make more commits.`,
`That's because you have been slacking.`,
@@ -127,12 +128,13 @@ var talk = []string{
`All that complexity stopped us from getting flying cars by today.`,
}
-func init() {
+// Random quote
+func Random() string {
rand.Seed(time.Now().UnixNano())
+ return Talk[rand.Intn(len(Talk))]
}
-// Quote returns random quote
+// Quote for backward compatibility, use Random instead
func Quote() string {
- n := rand.Intn(len(talk))
- return talk[n]
+ return Random()
}