Description
The GetValue
method of the RangedFloat
struct returns a single precision floating-point number that is randomly selected between the minimum and maximum values defined by the RangedFloat
instance. This method is useful when you need a random value within a specified range.
Usage
To use the GetValue
method, you must first have an instance of RangedFloat
. This instance should have its Min
and Max
properties set to define the range. Once the instance is configured, simply call GetValue
to retrieve a random value within the specified range.
Example
// Create a RangedFloat instance with a range from 1.0 to 5.0
RangedFloat rangedFloat = new RangedFloat { Min = 1.0f, Max = 5.0f };
// Get a random value within the specified range
float randomValue = rangedFloat.GetValue();
// Output the random value
// Note: Avoid using Console.WriteLine in s&box
// Instead, use the appropriate logging or debugging tools available in the environment
// Example: Log.Info($"Random Value: {randomValue}");