3 ms·
Since everyone here seems to be confused: yes, the Go compiler actively randomizes the order of the keys beyond the unpredictability inherent in hash tables. If
by yepguy 12y ago
Since everyone here seems to be confused: yes, the Go compiler actively randomizes the order of the keys beyond the unpredictability inherent in hash tables. If your function iterates over a map twice in a row without modifying it, you will get different orders.
- itripn 12y agoThat is empirically not true, at least under go 1.2.1. The poster's own code produces identical iteration results even when iterating the same unchanged Map multiple times in a single code execution.