Browse Source

feat: simplify to 1/3 probability each for -1/0/+1 version adjustment

Co-authored-by: RPRX <[email protected]>
copilot-swe-agent[bot] 4 months ago
parent
commit
4c77ae8c21
1 changed files with 7 additions and 18 deletions
  1. 7 18
      common/utils/browser.go

+ 7 - 18
common/utils/browser.go

@@ -14,25 +14,14 @@ func ChromeVersion() int {
 	if ver < 143 {
 		ver = 143
 	}
-	// Combine core version with CPU ID for machine-specific distribution
+	// Combine core version with CPU ID for machine-specific seed
 	seed := int(core.Version_x+core.Version_y+core.Version_z) + cpuid.CPU.Family + cpuid.CPU.Model
-	day := now.Day()
-	// Boundary between -1 and +1 zones is distributed between days 15-20
-	boundary := 15 + seed%6
-	if day < boundary {
-		// Before boundary: distribute -1 transition uniformly from day 1 to boundary-1
-		transitionDay := 1 + seed%(boundary-1)
-		if day >= transitionDay {
-			ver--
-		}
-	} else {
-		// From boundary to end of month: distribute +1 transition uniformly
-		lastDay := time.Date(now.Year(), now.Month()+1, 0, 0, 0, 0, 0, time.Local).Day()
-		daysRange := lastDay - boundary + 1
-		transitionDay := boundary + seed%daysRange
-		if day >= transitionDay {
-			ver++
-		}
+	// 1/3 probability each for -1, 0, +1 based on seed % 3
+	switch seed % 3 {
+	case 0:
+		ver--
+	case 2:
+		ver++
 	}
 	return ver
 }