Class UniformSampler
Returns uniformly distributed random values within a designated range.
Implements
Inherited Members
Namespace: UnityEngine.Perception.Randomization.Samplers
Assembly: Unity.Perception.Runtime.dll
Syntax
[Serializable]
public class UniformSampler : ISampler
Constructors
UniformSampler()
Constructs a UniformSampler
Declaration
public UniformSampler()
UniformSampler(float, float, bool, float, float)
Constructs a new uniform distribution sampler
Declaration
public UniformSampler(float min, float max, bool shouldCheckValidRange = false, float minAllowed = 0, float maxAllowed = 0)
Parameters
Type | Name | Description |
---|---|---|
float | min | The smallest value contained within the range |
float | max | The largest value contained within the range |
bool | shouldCheckValidRange | Whether the provided min and max values should be used to validate the range provided with minAllowed and maxAllowed |
float | minAllowed | The smallest min value allowed for this range |
float | 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 |
---|---|
float |
minAllowed
The smallest value this sampler should output
Declaration
public float minAllowed { get; set; }
Property Value
Type | Description |
---|---|
float |
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 |
---|---|
bool |
Methods
CheckAgainstValidRange()
Checks if range valid
Declaration
public void CheckAgainstValidRange()
Sample()
Generates one sample
Declaration
public float Sample()
Returns
Type | Description |
---|---|
float | The generated sample |
Validate()
Validates that the sampler is configured properly
Declaration
public void Validate()