Vector2 Random { get; set; }

robot_2Generated
code_blocksInput

Description

The Vector2.Random property provides a randomly generated 2D vector. This vector is uniformly sampled from all points within a unit circle centered at the origin, meaning the distance from the origin to the point is at most 1. This can be useful for generating random directions or positions within a bounded area.

Usage

To use the Vector2.Random property, simply access it directly as it is a static property. This will return a new Vector2 instance with random x and y components.

Example

// Example of using Vector2.Random
Vector2 randomVector = Vector2.Random;

// Output the random vector
// Note: Avoid using Console.WriteLine in s&box
// Instead, use the appropriate logging or debugging tools available in your environment
Debug.Log($"Random Vector: {randomVector}");