Class NormalSampler
Returns normally distributed random values bounded within a specified range https://en.wikipedia.org/wiki/Truncated_normal_distribution
Namespace: UnityEngine.Perception.Randomization.Samplers
Syntax
public class NormalSampler : object, ISampler
Constructors
NormalSampler()
Constructs a normal distribution sampler
Declaration
public NormalSampler()
NormalSampler(Single, Single, Single, Single, Boolean, Single, Single)
Constructs a normal distribution sampler
Declaration
public NormalSampler(float min, float max, float mean, float standardDeviation, 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 |
Single | mean | The mean of the normal distribution to sample from |
Single | standardDeviation | The standard deviation of the normal distribution to sample from |
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
mean
The mean of the normal distribution to sample from
Declaration
public float mean
Field Value
Type | Description |
---|---|
Single |
range
A range bounding the values generated by this sampler
Declaration
public FloatRange range
Field Value
Type | Description |
---|---|
FloatRange |
standardDeviation
The standard deviation of the normal distribution to sample from
Declaration
public float standardDeviation
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()