Skip to content

[Feature] Make Shuffle use printtarg's seeded randomisation (RANDOM_START) so -r / seed round-trips #90

Description

@itsab1989

Spun off from #89 (point 2) at Knut's request.

Problem / context

In the Edit / Create Chart Layout window the Shuffle button randomises patch order — but it does this as a ChromIQ operation (rewriting the .ti2 / its RANDOM_START tag), not via printtarg's own randomisation. That creates confusing situations once the layout reaches the Create Chart manual tab:

  • After Shuffle, the printtarg -r ("Preserve Patch Order" / don't randomise) flag state isn't clearly reflected in Set A, so the manual tab doesn't obviously show whether the chart is already randomised.
  • If the user then ticks the printtarg randomise option and presses Generate, printtarg randomises again — a different layout from the one they shuffled.
  • More generally: because Shuffle doesn't go through printtarg, the exact shuffled layout isn't trivially reproducible by re-running printtarg.

Knut's key insight

The .ti2 already records the seed in the RANDOM_START tag. If ChromIQ reads that seed, it can re-run printtarg -R <seed> and get the exact same sequence. So the layout can be made fully replicable and the -r / -R state can travel correctly into Set A.

Proposed direction

  • Have Shuffle randomise via printtarg with a generated seed, storing it in RANDOM_START, so:
    • the shuffled layout is reproducible (-R <seed>), and
    • the -r / -R state is correctly reflected when transferring to the Create Chart manual tab (so the user isn't confused, and won't accidentally re-randomise).
  • Clarify the relationship between Shuffle, the "Force randomised tag" checkbox, and the printtarg -r flag, and decide when -r should appear in Set A:
    • Shuffle pressed (already randomised) → -r set (preserve the shuffled order) + -R <seed> recorded.
    • Shuffle not pressed → reflect the appropriate -r / "Don't randomise patch location" state.
  • Add -r / -R to the set of layout attributes the Edit/Create Chart Layout window manages (it is not used in the New Chart window). The Add window keeps loading Set B generator settings as today.

Open questions to settle during design

  • What is Shuffle's intended role beyond representing -r? (Confirm the single source of truth.)
  • Should "Force randomised tag" be the thing that drives -r, or Shuffle, or both?

Relation to the Set A/B layout-sync work

Once -r / -R are first-class editor layout attributes, they fold naturally into the Set A ↔ Set B layout sync planned in #89 (which currently syncs only the fields Set B already has). Best done after that sync lands.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions