RangedFloat/RangeType Range { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The Range property of the RangedFloat struct specifies the type of range that the float value can have. This property determines whether the float is a fixed value or a range between two values. The RangeType can be used to define the behavior of the float, such as whether it should be treated as a fixed value or a random value within a specified range.

Usage

To use the Range property, you can access it directly from an instance of RangedFloat. This property is useful when you need to determine or set the type of range for a float value, especially when dealing with randomized values.

Example

// Example of using the RangedFloat struct and its Range property

// Create a RangedFloat with a specific range
RangedFloat rangedFloat = new RangedFloat
{
    Min = 1.0f,
    Max = 5.0f,
    Range = RangedFloat.RangeType.Random
};

// Access the Range property
RangedFloat.RangeType rangeType = rangedFloat.Range;

// Output the range type
// This will output: Random
System.Console.WriteLine($"Range Type: {rangeType}");

// Change the range type to Fixed
rangedFloat.Range = RangedFloat.RangeType.Fixed;

// Set a fixed value
rangedFloat.FixedValue = 3.0f;

// Output the new range type
// This will output: Fixed
System.Console.WriteLine($"New Range Type: {rangedFloat.Range}");