From 8247b1c01c4bbea0e1327a12d2b156cc98236786 Mon Sep 17 00:00:00 2001 From: showlovel Date: Mon, 18 Nov 2013 10:25:03 +0800 Subject: [PATCH] =?UTF-8?q?rand=20=E5=B7=B2=E7=BB=8F=E7=A7=BB=E5=88=B0=20m?= =?UTF-8?q?ath/rand=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- eBook/04.5.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/eBook/04.5.md b/eBook/04.5.md index c50277e..89b1fe7 100644 --- a/eBook/04.5.md +++ b/eBook/04.5.md @@ -348,25 +348,25 @@ Example 4.10 [random.go](examples/chapter_4/random.go) 演示了如何生成 10 package main import ( - “fmt” - “rand” - “time” + "fmt" + "math/rand" + "time" ) func main() { for i := 0; i < 10; i++ { a := rand.Int() - fmt.Printf(“%d / “, a) + fmt.Printf("%d / ", a) } for i := 0; i < 5; i++ { r := rand.Intn(8) - fmt.Printf(“%d / “, r) + fmt.Printf("%d / ", r) } fmt.Println() timens := int64(time.Now().Nanosecond()) rand.Seed(timens) for i := 0; i < 10; i++ { - fmt.Printf(“%2.2f / “, 100*rand.Float32()) + fmt.Printf("%2.2f / ", 100*rand.Float32()) } }