Skip to content

refactor: replace ad hoc random range arithmetic with Random.nextFloat extensions - #19

Merged
Attacktive merged 1 commit into
mainfrom
refactor/random-float-range-extension
Jul 24, 2026
Merged

refactor: replace ad hoc random range arithmetic with Random.nextFloat extensions#19
Attacktive merged 1 commit into
mainfrom
refactor/random-float-range-extension

Conversation

@Attacktive

Copy link
Copy Markdown
Owner

Summary

  • Add Random.nextFloat(from, until) and Random.nextFloat(until) extensions in a new RandomFloat.kt, mirroring the stdlib's ranged nextInt overloads
  • Replace ~60 scattered from + random.nextFloat() * (until - from)-shaped expressions across BackdropScenery.kt and SceneRenderer.kt with calls to the new extensions
  • Drop the private between(random, low, high) helper in BackdropScenery.kt in favor of the extension

Test plan

  • ./gradlew compileDebugKotlin passes
  • ./gradlew testDebugUnitTest passes (including BackdropSceneryTest's pinned-shape assertions, confirming no numeric regression from the reassociated float arithmetic)

🤖 Generated with Claude Code

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

…t extensions

Scattered from + random.nextFloat() * (until - from) expressions across the
scenery and scene renderer made the intended range hard to see at a glance
and were easy to get wrong. Add Random.nextFloat(from, until) and
Random.nextFloat(until) extensions mirroring the stdlib's ranged nextInt
overloads, and switch every matching call site in BackdropScenery.kt and
SceneRenderer.kt to use them.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@Attacktive
Attacktive force-pushed the refactor/random-float-range-extension branch from e457769 to 799f6fa Compare July 24, 2026 01:07
@Attacktive
Attacktive merged commit 799f6fa into main Jul 24, 2026
5 of 6 checks passed
@Attacktive
Attacktive deleted the refactor/random-float-range-extension branch July 24, 2026 01:12
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.

1 participant