Files
zzg 8e3746063c
ci / test (push) Canceled after 0s
initial commit
2026-09-25 21:27:46 -07:00

16 lines
348 B
Go

package markov
import "sort"
// sortedKeys returns the map's keys in a stable order, so that sampling
// depends only on the supplied rng and not on Go's randomised map
// iteration.
func sortedKeys(m map[string]int) []string {
keys := make([]string, 0, len(m))
for k := range m {
keys = append(keys, k)
}
sort.Strings(keys)
return keys
}