randomOffset method

Offset randomOffset()

Get random offset inside the rectangle

Implementation

Offset randomOffset() {
  final maxX = (width + left);
  final minX = left;
  final maxY = (height + top);
  final minY = top;

  return Offset(
    minX + (Random().nextDouble() * (maxX - minX)),
    minY + (Random().nextDouble() * (maxY - minY)),
  );
}