2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
24
Task/Singleton/Go/singleton-7.go
Normal file
24
Task/Singleton/Go/singleton-7.go
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"math/rand"
|
||||
"time"
|
||||
|
||||
"blue"
|
||||
"red"
|
||||
"single"
|
||||
)
|
||||
|
||||
func main() {
|
||||
rand.Seed(time.Now().Unix())
|
||||
switch rand.Intn(3) {
|
||||
case 1:
|
||||
red.SetColor()
|
||||
blue.SetColor()
|
||||
case 2:
|
||||
blue.SetColor()
|
||||
red.SetColor()
|
||||
}
|
||||
log.Println(single.Color())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue