Back to all rules
What this rule checks
Flags random(1) == 0 ? 1 : -1 — a pattern students almost never write but AI tools generate frequently for random movement
Configuration
When off, this rule is excluded from pipeline runs. Changes apply immediately.
Code Examples
PASS — this code satisfies the rule
float dx = 2;

void setup() {
  size(400, 400);
  if (random(1) < 0.5) {
    dx = -dx;
  }
}

void draw() {
  background(255);
  ellipse(200 + dx * frameCount, 200, 30, 30);
}
FAIL — this code triggers the rule
float dx = 2;

void setup() {
  size(400, 400);
  dx = dx * (random(1) < 0.5 ? 1 : -1);  // the random +1/-1 ternary
}

void draw() {
  background(255);
  ellipse(200 + dx * frameCount, 200, 30, 30);
}
Overview
Category Academic Integrity
Type Custom Zita
Priority 2 (1 = highest, 5 = lowest)
Status Active
PMD Configuration
Java class nl.utwente.processing.pmd.rules.HasRandomDirectionPatternRule
Message template AI-typical random direction pattern detected.