all repos — captcha @ 997004be41f20283d2d8a8c0f88146e279d91a39

Go package captcha implements generation and verification of image and audio CAPTCHAs.

Fix condition; remove unreachable panic.
Dmitry Chestnykh dmitry@codingrobots.com
Sat, 09 Aug 2014 16:05:42 +0200
commit

997004be41f20283d2d8a8c0f88146e279d91a39

parent

31461913baa731d3b683912c0f01441dfc9a2ca1

1 files changed, 1 insertions(+), 2 deletions(-)

jump to
M random.gorandom.go

@@ -78,7 +78,7 @@ i := 0

for { r := randomBytes(length + (length / 4)) for _, c := range r { - if c >= maxrb { + if c > maxrb { // Skip this number to avoid modulo bias. continue }

@@ -89,7 +89,6 @@ return

} } } - panic("unreachable") } // randomId returns a new random id string.