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: underlying issue of generate_range of signed integers being off by 1 #48

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

Conversation

StT191
Copy link

@StT191 StT191 commented Jan 30, 2024

This fixes the underlying issue of WyRand::generate_range being off by 1.

While this pull request allegedly was supposed to fix this earlier version of the issue, the underlying issue was not the lower bound on line 55 but rather the conversion from the unsigned to signed integer on line 64 being off by one. The change on line 55 introduced a new bug whereby generate_range(0..1) would be considered out of bounds.

I added new tests for generate_range(0..1) for signed as well as unsigned integer ranges.

…by 1

test: add tests for generate_ranges of length 1
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.

generate_range shifts values incorrectly for signed integers
1 participant