Class FloatSequenceGenerator
- Namespace
- LfrlAnvil.Generators
- Assembly
- LfrlAnvil.Core.dll
Represents float sequence generator of values within specified range.
public class FloatSequenceGenerator : SequenceGeneratorBase<float>, ISequenceGenerator<float>, IBoundGenerator<float>, IGenerator<float>, IGenerator
- Inheritance
-
FloatSequenceGenerator
- Implements
- Inherited Members
- Extension Methods
Constructors
FloatSequenceGenerator()
Creates a new FloatSequenceGenerator instance that starts with 0, with Step equal to 1 and with greatest possible Bounds.
public FloatSequenceGenerator()
FloatSequenceGenerator(Bounds<float>)
Creates a new FloatSequenceGenerator instance that starts with
minimum possible value defined by bounds
, with Step equal to 1.
public FloatSequenceGenerator(Bounds<float> bounds)
Parameters
FloatSequenceGenerator(Bounds<float>, float, float)
Creates a new FloatSequenceGenerator instance.
public FloatSequenceGenerator(Bounds<float> bounds, float start, float step = 1)
Parameters
bounds
Bounds<float>Range of values that can be generated.
start
floatNext value to generate.
step
floatDifference between two consecutively generated values. Equal to 1 by default.
Exceptions
- ArgumentOutOfRangeException
When
bounds
do not containstart
.- ArgumentException
When
step
is equal to 0 or any of the values is not a finite number.
FloatSequenceGenerator(float, float)
Creates a new FloatSequenceGenerator instance with greatest possible Bounds.
public FloatSequenceGenerator(float start, float step = 1)
Parameters
start
floatNext value to generate.
step
floatDifference between two consecutively generated values. Equal to 1 by default.
Exceptions
- ArgumentException
When
step
is equal to 0 or any of the values is not a finite number.
Methods
AddStep(float)
Adds Step to the previously generated value in order to calculate the next value to generate.
protected override sealed float AddStep(float value)
Parameters
value
floatPreviously generated value.
Returns
- float
Next value to generate.
Exceptions
- OverflowException
When an arithmetic overflow occurred.