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

randNumeric returns values that are interpreted as octal #263

Closed
danielhoherd opened this issue Oct 19, 2020 · 1 comment
Closed

randNumeric returns values that are interpreted as octal #263

danielhoherd opened this issue Oct 19, 2020 · 1 comment

Comments

@danielhoherd
Copy link
Contributor

danielhoherd commented Oct 19, 2020

randNumeric returns values that are interpreted as octal. This causes problems when randNumeric returns numbers that are invalid octal numbers, like 08 and 09. Errors related to this happen silently when passed to mul and div, resulting in random numbers that are heavily weighted to 0.

EG: when running 1000 iterations of {{ mul (randNumeric 2) 6 }}, the top 5 chosen numbers and their count were:

number times chosen
30 16
156 17
24 17
468 18
0 36

When attempting things like {{ mul 08 6 }}, {{ div 09 3 }} a parse error arises, but when the octal numbers are generated by randNumeric the octal numbers are accepted and no error is seen.

@danielhoherd
Copy link
Contributor Author

Closing this since it belongs in Masterminds/goutils/issues/31

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

No branches or pull requests

1 participant