1
0
mirror of https://github.com/golang/go synced 2024-11-21 22:14:41 -07:00

json: fix test if rand returns 0.

Fixes test when run with gccgo using optimization, which
changes the order of the calls to rand.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4639101
This commit is contained in:
Ian Lance Taylor 2011-07-06 13:00:54 -07:00
parent 6732bd3526
commit 7b0bb48056

View File

@ -252,7 +252,10 @@ func genArray(n int) []interface{} {
if f > n {
f = n
}
x := make([]interface{}, int(f))
if n > 0 && f == 0 {
f = 1
}
x := make([]interface{}, f)
for i := range x {
x[i] = genValue(((i+1)*n)/f - (i*n)/f)
}