summaryrefslogtreecommitdiff
path: root/theo.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2016-08-17 06:54:45 +0200
committerDimitri Sokolyuk <demon@dim13.org>2016-08-17 06:54:45 +0200
commit05e44aa867b85303e21136f9eed9e99923f9bdf0 (patch)
treee768fb4b5ea94531bc115355319bfe1245b99967 /theo.go
parent78aafbd792f19b2c6ef71b4624dc7129c73b26df (diff)
Export Talk
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()
}