Skip to content

Instantly share code, notes, and snippets.

@bontusss
Created December 26, 2022 03:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bontusss/fcad8b929dcb508593134fc9d80fcddc to your computer and use it in GitHub Desktop.
Save bontusss/fcad8b929dcb508593134fc9d80fcddc to your computer and use it in GitHub Desktop.
Sprinkle program
package main
import (
"bufio"
"fmt"
"math/rand"
"os"
"strings"
"time"
)
const otherWord = "*"
var transforms = []string{
otherWord + "app",
otherWord + "site",
otherWord + "time",
"get" + otherWord,
"go" + otherWord,
"lets" + otherWord,
otherWord + "hq",
}
func main() {
rand.Seed(time.Now().UTC().UnixNano())
s := bufio.NewScanner(os.Stdin)
for s.Scan() {
t := transforms[rand.Intn(len(transforms))]
fmt.Println(strings.Replace(t, otherWord, s.Text(), -1))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment