Description
The VectorInCircle
method is an extension method for the System.Random
class. It generates a random Vector2
point within a circle of a specified radius. This method is useful for scenarios where you need to randomly position objects within a circular area.
Usage
To use the VectorInCircle
method, you need to have an instance of System.Random
. You can then call this method on the instance, passing the desired radius of the circle as a parameter. The method will return a Vector2
representing a random point within the circle.
Example
// Example usage of VectorInCircle
Random random = new Random();
float radius = 5.0f;
Vector2 randomPoint = random.VectorInCircle(radius);
// randomPoint now contains a random position within a circle of radius 5.0