3 ms·
The ordering is only quasi-random, depending on how keys are distributed across hash buckets. Your particular example will no longer have a consistent iteration
by teraflop 13y ago
The ordering is only quasi-random, depending on how keys are distributed across hash buckets. Your particular example will no longer have a consistent iteration order starting in Go 1.3.
https://code.google.com/p/go/issues/detail?id=6719 https://code.google.com/p/go/issues/detail?id=6719
- vardump 13y agoSo random order in Go1.3. Sounds good to me. Tried anyways with ten items, the results are interesting: http://play.golang.org/p/dVZvmBOu_g http://play.golang.org/p/dVZvmBOu_g With ten items, it seems to randomly (?) alternate between two iteration orders. Local Go1.2.1 has similar behavior.