From b204ba95784d0b44033f19e4eafd91c1061854bc Mon Sep 17 00:00:00 2001 From: Weilin Shi <934587911@qq.com> Date: Mon, 26 Mar 2018 11:08:21 +0800 Subject: [PATCH] Simplify drawSineCurve function --- captcha.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/captcha.go b/captcha.go index 497c3c7..28e2ea9 100644 --- a/captcha.go +++ b/captcha.go @@ -208,9 +208,8 @@ func drawSineCurve(img *image.NRGBA, opts *Options) { curveHeight := float64(rng.Intn(opts.height/6) + opts.height/6) yStart := rng.Intn(opts.height*2/3) + opts.height/6 angle := 1.0 + rng.Float64() - flip := rng.Intn(2) == 0 yFlip := 1.0 - if flip { + if rng.Intn(2) == 0 { yFlip = -1.0 } curveColor := randomInvertColor(opts.BackgroundColor)