Class UniformSampler
Returns uniformly distributed random values within a designated range.
Namespace: UnityEngine.Perception.Randomization.Samplers
Syntax
public class UniformSampler : object, ISampler
Constructors
UniformSampler()
Constructs a UniformSampler
Declaration
public UniformSampler()
UniformSampler(Single, Single, Boolean, Single, Single)
Constructs a new uniform distribution sampler
Declaration
public UniformSampler(float min, float max, bool shouldCheckValidRange = false, float minAllowed = null, float maxAllowed = null)
Parameters
Type | Name | Description |
---|---|---|
Single | min | The smallest value contained within the range |
Single | max | The largest value contained within the range |
Boolean | shouldCheckValidRange | Whether the provided minAllowed and maxAllowed values should be used to validate the range provided with |
Single | minAllowed | The smallest min value allowed for this range |
Single | maxAllowed | The largest max value allowed for this range |
Fields
range
A range bounding the values generated by this sampler
Declaration
public FloatRange range
Field Value
Type | Description |
---|---|
FloatRange |
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()