Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix rand.Intn painc #118

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

fix rand.Intn painc #118

wants to merge 1 commit into from

Conversation

zuiwuchang
Copy link

#109

大量的 rand.Intn 調用在傳入非法參數時將引發 painc。但通常這是 rand.Intn 返回 0 而非 painc 可能會使 base64Captcha 庫更容易使用。這份 pull 將對 rand.Intn 的調用替換爲了下述代碼以避免 painc

func randIntn(n int) int {
	if n > 0 {
		return rand.Intn(n)
	}
	return 0
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant