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

Math Expression result are not between min and max config options #34

Open
jmaguirrei opened this issue May 7, 2019 · 1 comment
Open

Comments

@jmaguirrei
Copy link

Bug: Math Expression result are not between min and max config options
Version: 1.4.0

Current behavior:

svgCaptcha.createMathExpr({
   noise: 1,
   mathMin: 1,
   mathMax: 9,
   background: 'black',
});

outputs: 6 + 5, 5 + 6, 3 + 4, ...

Expected behavior:
According to the docs, the result of the expression must be between 1 and 9

It seems each element in the expression is between mathMin and mathMax but not the result.

May be a bug either in the implementation or in the docs.

Thanks

@amit10may
Copy link

amit10may commented Aug 26, 2020

I am also facing same issue.
UPDATE: Seems I was using an older version - the recent version has fixes in lib/random.js and lib/index.js
It may still be confusing as to what is real contract of the range. Simpler option could be to set a min and max range for each operand instead of final result.

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

No branches or pull requests

2 participants