Skip to content

Add setRandom(Random) to RandomPointsBuilder #1214

Open
woogi-kim wants to merge 2 commits into
locationtech:masterfrom
woogi-kim:feature/random-points-builder-seed
Open

Add setRandom(Random) to RandomPointsBuilder #1214
woogi-kim wants to merge 2 commits into
locationtech:masterfrom
woogi-kim:feature/random-points-builder-seed

Conversation

@woogi-kim

Copy link
Copy Markdown

Summary

Allow passing a Random instance to RandomPointsBuilder and RandomPointsInGridBuilder to enable reproducible
point generation, as suggested by @dr-jts in #1191.

Changes

  • Added setRandom(Random) setter to RandomPointsBuilder
  • Added setRandom(Random) setter to RandomPointsInGridBuilder
  • Replaced Math.random() with random.nextDouble() in both classes
  • Default behavior is unchanged (uses new Random())
  • Added RandomPointsBuilderTest and RandomPointsInGridBuilderTest

Validation

mvn test -pl modules/core -Dtest="RandomPointsBuilderTest,RandomPointsInGridBuilderTest"

- Tests run: 8
- Failures: 0
- Errors: 0

Closes #1191

woogi-kim and others added 2 commits July 12, 2026 21:20
Allow passing a Random instance to RandomPointsBuilder to enable
deterministic point generation. This is useful for testing and
development where reproducible random configurations are needed.

Closes locationtech#1191

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: MinUk <qjvk2880@gmail.com>
…ehavior

Apply the same change as RandomPointsBuilder to RandomPointsInGridBuilder,
replacing Math.random() with an injectable Random instance.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: MinUk <qjvk2880@gmail.com>
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.

Allow passing a seed to RandomPointsBuilder, to enable reproducible behavior.

1 participant