Skip to content

Commit 8c40578

Browse files
authored
Merge pull request #3014 from lifenjoiner/ph
2 parents 4457dd5 + 77b3c65 commit 8c40578

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

dnscrypt-proxy/serversInfo.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@ func (s LBStrategyPN) getActiveCount(serversCount int) int {
9898
type LBStrategyPH struct{}
9999

100100
func (LBStrategyPH) getCandidate(serversCount int) int {
101-
return rand.Intn(Max(Min(serversCount, 2), serversCount/2))
101+
return rand.Intn((serversCount + 1) / 2)
102102
}
103103

104104
func (LBStrategyPH) getActiveCount(serversCount int) int {
105-
return Max(Min(serversCount, 2), serversCount/2)
105+
return (serversCount + 1) / 2
106106
}
107107

108108
type LBStrategyFirst struct{}

0 commit comments

Comments
 (0)