- Sort Score
- Result 10 results
- Languages All
Results 1 - 2 of 2 for shuffleByWeight (0.16 sec)
-
src/net/dnsclient.go
Weight uint16 } // byPriorityWeight sorts SRV records by ascending priority and weight. type byPriorityWeight []*SRV // shuffleByWeight shuffles SRV records by weight using the algorithm // described in RFC 2782. func (addrs byPriorityWeight) shuffleByWeight() { sum := 0 for _, addr := range addrs { sum += int(addr.Weight) } for sum > 0 && len(addrs) > 1 { s := 0 n := randIntn(sum)
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu May 23 01:16:53 UTC 2024 - 5.7K bytes - Viewed (0) -
src/net/dnsclient_test.go
sum += int(srv.Weight) } results := make(map[string]int) count := 10000 for j := 0; j < count; j++ { d := make([]*SRV, len(data)) copy(d, data) byPriorityWeight(d).shuffleByWeight() key := d[0].Target results[key] = results[key] + 1 } actual := results[data[0].Target] expected := float64(count) * float64(data[0].Weight) / float64(sum) diff := float64(actual) - expected
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Oct 12 16:30:11 UTC 2020 - 1.5K bytes - Viewed (0)