mirror of
https://github.com/golang/go
synced 2024-11-25 09:17:57 -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:
parent
6732bd3526
commit
7b0bb48056
@ -252,7 +252,10 @@ func genArray(n int) []interface{} {
|
|||||||
if f > n {
|
if f > n {
|
||||||
f = n
|
f = n
|
||||||
}
|
}
|
||||||
x := make([]interface{}, int(f))
|
if n > 0 && f == 0 {
|
||||||
|
f = 1
|
||||||
|
}
|
||||||
|
x := make([]interface{}, f)
|
||||||
for i := range x {
|
for i := range x {
|
||||||
x[i] = genValue(((i+1)*n)/f - (i*n)/f)
|
x[i] = genValue(((i+1)*n)/f - (i*n)/f)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user