Vector2.random constructor

Vector2.random([Random rng ])

Generate random vector in the range (0, 0) to (1, 1). You can optionally pass your own random number generator.

Implementation

factory Vector2.random([math.Random rng]) {
  rng ??= new math.Random();
  return new Vector2(rng.nextDouble(), rng.nextDouble());
}