Skip to content

Fix repeated randomization patterns across paths in Copy to Points#4243

Closed
Sanketjadhav31 wants to merge 2 commits into
GraphiteEditor:masterfrom
Sanketjadhav31:fix-copy-to-points-rng-reset
Closed

Fix repeated randomization patterns across paths in Copy to Points#4243
Sanketjadhav31 wants to merge 2 commits into
GraphiteEditor:masterfrom
Sanketjadhav31:fix-copy-to-points-rng-reset

Conversation

@Sanketjadhav31

Copy link
Copy Markdown

Summary

This fixes an issue in copy_to_points() where random scale and rotation values could repeat across different paths when using the same seed.

The RNGs were being initialized inside the outer row loop, which caused the random sequence to restart for each path. As a result, corresponding points on different paths could receive identical random values.

The fix moves RNG initialization outside the loop so the RNG state is preserved across all paths while still remaining deterministic for a given seed.

Testing

Manual testing:

  • Created multiple paths and used Copy to Points with random scale enabled
  • Verified copies were generated correctly across paths
  • Tested random rotation with non-symmetrical shapes
  • Confirmed no crashes or rendering issues

Automated testing:

  • Added a regression test covering multiple paths
  • Verified the test fails with the buggy implementation
  • Verified the test passes with the fix
  • Ran the vector-nodes test suite successfully

The Copy to Points node was resetting RNG state for each vector path,
causing all paths to receive identical 'random' values instead of
unique randomization. This made procedural artwork with multiple
paths look repetitive instead of varied.

Fixed by moving RNG initialization outside the path iteration loop,
ensuring continuous random sequence across all paths and points.

Also moves do_scale and do_rotation calculations outside the loop
as a minor performance improvement.

Includes regression test to prevent future occurrence.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request fixes a bug in the copy_to_points function where the random number generators (scale_rng and rotation_rng) were being reinitialized inside the loop for each path, resulting in identical random sequences across different paths. The RNGs are now initialized once before the loop. A regression test copy_to_points_unique_randomization has also been added to ensure unique randomization across separate paths. There are no review comments, and no further feedback is required.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@Sanketjadhav31 Sanketjadhav31 marked this pull request as ready for review June 16, 2026 18:23

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@Keavon

Keavon commented Jun 16, 2026

Copy link
Copy Markdown
Member

This PR appears to be entirely AI generated based on the looks of it, in violation of our AI contribution policy. I also do not see an issue mentioned, so as far as I know, the issue being addressed here may be entirely hallucinated.

@Keavon Keavon closed this Jun 16, 2026
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