Struct ConstantSampler
Returns a constant value when sampled
Inherited Members
Namespace: UnityEngine.Experimental.Perception.Randomization.Samplers
Syntax
[Serializable]
public struct ConstantSampler : ISampler
Constructors
ConstantSampler(Single)
Constructs a new ConstantSampler
Declaration
public ConstantSampler(float value)
Parameters
Type | Name | Description |
---|---|---|
Single | value | The value from which samples will be generated |
Fields
value
The value from which samples will be generated
Declaration
public float value
Field Value
Type | Description |
---|---|
Single |
Properties
baseSeed
The base seed used to initialize this sampler's state. Note that ConstantSamplers do not utilize a baseSeed.
Declaration
public uint baseSeed { get; set; }
Property Value
Type | Description |
---|---|
UInt32 |
Implements
range
A range bounding the values generated by this sampler
Declaration
public FloatRange range { get; set; }
Property Value
Type | Description |
---|---|
FloatRange |
Implements
state
The current random state of this sampler. Note that ConstantSamplers do not utilize a random state.
Declaration
public uint state { get; set; }
Property Value
Type | Description |
---|---|
UInt32 |
Implements
Methods
IterateState(Int32)
Deterministically offsets a sampler's state. Note that ConstantSamplers do not have a state to iterate.
Declaration
public void IterateState(int offsetIndex)
Parameters
Type | Name | Description |
---|---|---|
Int32 | offsetIndex | The index used to offset the sampler's state. Typically set to either the current scenario iteration or a job's batch index. |
Implements
ResetState()
Resets a sampler's state to its base random seed. Note that there is no state to reset for ConstantSamplers.
Declaration
public void ResetState()
Implements
Sample()
Generates one sample
Declaration
public float Sample()
Returns
Type | Description |
---|---|
Single | The generated sample |
Implements
Samples(Int32, out JobHandle)
Schedules a job to generate an array of samples
Declaration
public NativeArray<float> Samples(int sampleCount, out JobHandle jobHandle)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sampleCount | The number of samples to generate |
JobHandle | jobHandle | The handle of the scheduled job |
Returns
Type | Description |
---|---|
NativeArray<Single> | A NativeArray of generated samples |