Vector3 Random { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The Vector3.Random property provides a way to generate a random 3D vector. This vector is uniformly sampled from all points within a unit sphere centered at the origin, meaning that 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 space.

Usage

To use the Vector3.Random property, simply access it directly as it is a static property. This will return a new Vector3 instance with random x, y, and z components, each within the range that ensures the vector's length does not exceed 1.

Example

// Example of using Vector3.Random
Vector3 randomVector = Vector3.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
Log.Info($"Random Vector: {randomVector}");