Skip to content

Fix range selection to be inclusive#59

Merged
chazzu merged 1 commit intochazzu:masterfrom
Snuffy2:Fix-range-selection-to-be-inclusive
Oct 6, 2025
Merged

Fix range selection to be inclusive#59
chazzu merged 1 commit intochazzu:masterfrom
Snuffy2:Fix-range-selection-to-be-inclusive

Conversation

@Snuffy2
Copy link
Contributor

@Snuffy2 Snuffy2 commented Oct 5, 2025

This pull request improves the inclusivity of random value generation in the get_static_or_random method within animations.py. The changes ensure that both float and integer ranges can correctly include their configured upper bounds, addressing edge cases where the previous implementation would exclude them.

Random value generation improvements:

  • For float ranges, uses math.nextafter to nudge the upper bound slightly upward, making the rounded result inclusively reach the configured upper value. This ensures that the upper bound can be selected when generating random floats.
  • For integer ranges, adjusts the stop value in randrange by adding step, making the range inclusive when the upper bound aligns with the step.
  • Imports the math module to support these changes.

@chazzu chazzu merged commit 6e28813 into chazzu:master Oct 6, 2025
3 checks passed
@Snuffy2 Snuffy2 deleted the Fix-range-selection-to-be-inclusive branch October 6, 2025 01:43
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.

2 participants