Skip to content

Instantly share code, notes, and snippets.

@178inaba
Created August 18, 2015 03:29
Show Gist options
  • Select an option

  • Save 178inaba/4a071cfb36da16681bbc to your computer and use it in GitHub Desktop.

Select an option

Save 178inaba/4a071cfb36da16681bbc to your computer and use it in GitHub Desktop.
matrix from go
package main
import (
"fmt"
"math/rand"
"time"
)
func main() {
box := append(packRune('0', '9'), packRune('a', 'z')...)
box = append(box, packRune('A', 'Z')...)
rand.Seed(time.Now().UnixNano())
for {
fmt.Print("\x1b[32m", string(box[rand.Intn(len(box))]), "\x1b[0m")
time.Sleep(100 * time.Microsecond)
}
}
func packRune(start, end rune) []rune {
var box []rune
r := start
for r-1 != end {
box = append(box, r)
r++
}
return box
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment