Created
March 14, 2018 16:52
-
-
Save brianloveswords/467802cee64aa66200d34646c3a5451c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// 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