Skip to content

Extended RandomResolver to support inclusive max range.#16

Merged
lextatic merged 3 commits intomainfrom
feature/add-inclusive-option-for-random-resolver
May 2, 2026
Merged

Extended RandomResolver to support inclusive max range.#16
lextatic merged 3 commits intomainfrom
feature/add-inclusive-option-for-random-resolver

Conversation

@lextatic
Copy link
Copy Markdown
Contributor

@lextatic lextatic commented May 2, 2026

Added

  • Added inclusive methods to IRandom interface.
  • New test cases.

Changed

  • Modified RandomResolver to receive optional configuration to configure max as inclusive or exclusive. Inclusive by default.

@lextatic lextatic added the changed Changes in existing functionality label May 2, 2026
@lextatic lextatic requested a review from Copilot May 2, 2026 01:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the statescript RandomResolver and the core IRandom abstraction to support inclusive max bounds (with configurability), and refreshes docs/tests to reflect the new behavior.

Changes:

  • Added inclusive-range methods to IRandom (NextIntInclusive, NextSingleInclusive, NextDoubleInclusive, NextInt64Inclusive).
  • Extended RandomResolver with a maxInclusive configuration (defaulting to inclusive) and updated float/double behavior accordingly.
  • Updated documentation and expanded unit tests/helpers for the new inclusive/exclusive paths.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
docs/statescript/resolvers/random-resolver.md Documents the new maxInclusive parameter and inclusive-by-default behavior.
docs/effects/components.md Updates the documented IRandom interface to include inclusive methods.
Forge/Statescript/Properties/RandomResolver.cs Implements inclusive/exclusive max selection and new float/double handling.
Forge/Core/IRandom.cs Adds new inclusive methods to the public random provider interface.
Forge.Tests/Statescript/Resolvers/RandomResolverTests.cs Adds coverage for inclusive-by-default and exclusive configuration paths.
Forge.Tests/Helpers/StatescriptTestHelpers.cs Extends test random providers to implement the new IRandom members.
Forge.Tests/Effects/ChanceToApplyComponentTests.cs Updates the test random provider to satisfy the expanded IRandom interface.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Forge/Statescript/Properties/RandomResolver.cs Outdated
Comment thread Forge.Tests/Statescript/Resolvers/RandomResolverTests.cs Outdated
Comment thread Forge/Core/IRandom.cs
Comment thread Forge/Statescript/Properties/RandomResolver.cs Outdated
Comment thread Forge/Statescript/Properties/RandomResolver.cs Outdated
@lextatic lextatic changed the title Modified Random Resolver to support inclusive max range. Extended RandomResolver to support inclusive max range. May 2, 2026
@lextatic lextatic merged commit 27e7a2b into main May 2, 2026
1 check passed
@lextatic lextatic deleted the feature/add-inclusive-option-for-random-resolver branch May 2, 2026 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changed Changes in existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants