Description
The Vector3.Random
property provides a static method to generate a random 3D vector. This vector is uniformly sampled from all points within a unit sphere centered at the origin, meaning the vector's length will be at most 1. This is useful for generating random directions or positions within a bounded space.
Usage
To use the Vector3.Random
property, simply access it directly since it is a static property. It does not require any parameters and will return a Vector3
object.
Example
// Example of using Vector3.Random to generate a random vector
Vector3 randomVector = Vector3.Random;
// Output the random vector
// Note: Avoid using Console.WriteLine in s&box, use logging or debugging tools instead
Log.Info($"Random Vector: {randomVector}");