mirror of
https://github.com/golang/go
synced 2024-11-19 07:54:43 -07:00
math/rand: fix example_test to show with the correct method
Originally it used r.Int63() to show "Uint32", and now we use the correct r.Uint32() method. Fixes #9429 Change-Id: I8a1228f1ca1af93b0e3104676fc99000257c456f Reviewed-on: https://go-review.googlesource.com/2069 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
fbdf59a7c4
commit
59cb2d9ca6
@ -72,7 +72,7 @@ func Example_rand() {
|
|||||||
// depending on the size of 'int'.
|
// depending on the size of 'int'.
|
||||||
show("Int31", r.Int31(), r.Int31(), r.Int31())
|
show("Int31", r.Int31(), r.Int31(), r.Int31())
|
||||||
show("Int63", r.Int63(), r.Int63(), r.Int63())
|
show("Int63", r.Int63(), r.Int63(), r.Int63())
|
||||||
show("Uint32", r.Int63(), r.Int63(), r.Int63())
|
show("Uint32", r.Uint32(), r.Uint32(), r.Uint32())
|
||||||
|
|
||||||
// Intn, Int31n, and Int63n limit their output to be < n.
|
// Intn, Int31n, and Int63n limit their output to be < n.
|
||||||
// They do so more carefully than using r.Int()%n.
|
// They do so more carefully than using r.Int()%n.
|
||||||
@ -89,7 +89,7 @@ func Example_rand() {
|
|||||||
// NormFloat64 0.17233959114940064 1.577014951434847 0.04259129641113857
|
// NormFloat64 0.17233959114940064 1.577014951434847 0.04259129641113857
|
||||||
// Int31 1501292890 1486668269 182840835
|
// Int31 1501292890 1486668269 182840835
|
||||||
// Int63 3546343826724305832 5724354148158589552 5239846799706671610
|
// Int63 3546343826724305832 5724354148158589552 5239846799706671610
|
||||||
// Uint32 5927547564735367388 637072299495207830 4128311955958246186
|
// Uint32 2760229429 296659907 1922395059
|
||||||
// Intn(10) 1 2 5
|
// Intn(10) 1 2 5
|
||||||
// Int31n(10) 4 7 8
|
// Int31n(10) 4 7 8
|
||||||
// Int63n(10) 7 6 3
|
// Int63n(10) 7 6 3
|
||||||
|
Loading…
Reference in New Issue
Block a user