random2D_v3 static method

PVector random2D_v3(
  1. PVector? target,
  2. PApplet? parent
)

Make a new 2D unit vector with a random direction. Pass in the parent PApplet if you want randomSeed() to work (and be predictable). Or leave it null and be... random. @return the random PVector

Implementation

static PVector random2D_v3(PVector? target, PApplet? parent) {
  return (parent == null)
      ? fromAngle_v2(math.Random().nextDouble() * math.pi * 2, target)
      : fromAngle_v2(parent.random(PConstants.TAU), target);
}