Class ConstantSampler
Returns a constant value when sampled
Namespace: UnityEngine.Perception.Randomization.Samplers
Syntax
public class ConstantSampler : object, ISampler
Constructors
ConstantSampler()
Constructs a ConstantSampler
Declaration
public ConstantSampler()
ConstantSampler(Single, Boolean, Single, Single)
Constructs a new ConstantSampler
Declaration
public ConstantSampler(float value, bool shouldCheckValidRange = false, float minAllowed = null, float maxAllowed = null)
Parameters
Type | Name | Description |
---|---|---|
Single | value | The value from which samples will be generated |
Boolean | shouldCheckValidRange | Whether the provided minAllowed and maxAllowed values should be used to validate the value provided |
Single | minAllowed | The smallest min value allowed for this range |
Single | maxAllowed | The largest max value allowed for this range |
Fields
value
The value from which samples will be generated
Declaration
public float value
Field Value
Type | Description |
---|---|
Single |
Properties
maxAllowed
The largest value this sampler should output
Declaration
public float maxAllowed { get; set; }
Property Value
Type | Description |
---|---|
Single |
Implements
minAllowed
The smallest value this sampler should output
Declaration
public float minAllowed { get; set; }
Property Value
Type | Description |
---|---|
Single |
Implements
shouldCheckValidRange
Whether the provided minAllowed and maxAllowed values should be used to validate this sampler.
Declaration
public bool shouldCheckValidRange { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Implements
Methods
CheckAgainstValidRange()
Declaration
public void CheckAgainstValidRange()
Implements
Sample()
Generates one sample
Declaration
public float Sample()
Returns
Type | Description |
---|---|
Single | The generated sample |
Implements
Validate()
Validates that the sampler is configured properly
Declaration
public void Validate()