Skip to content

Instantly share code, notes, and snippets.

@brianloveswords
Created March 14, 2018 16:52
Show Gist options
  • Save brianloveswords/467802cee64aa66200d34646c3a5451c to your computer and use it in GitHub Desktop.
Save brianloveswords/467802cee64aa66200d34646c3a5451c to your computer and use it in GitHub Desktop.
/// Print out 140 characters of random celebratory emoji.
package main
import (
"fmt"
"math/rand"
"time"
)
const NumberOfCharacters = 140
func randomItem(array []string) string {
max := len(array)
index := rand.Intn(max)
return array[index]
}
func main() {
// go's random number generator is deterministic by default, so if
// we want different celebrations on each run we're going to have
// to seed it.
rand.Seed(time.Now().UnixNano())
celebration := []string{"πŸŽ‰", "✨", "🎊", "🎁", "πŸ‘πŸ½", "πŸ™ŒπŸ½", "🍾"}
for count := 0; count < NumberOfCharacters; count++ {
fmt.Print(randomItem(celebration))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment