Struct NormalSampler | Perception | 0.5.0-preview.1
docs.unity3d.com
    Show / Hide Table of Contents

    Struct NormalSampler

    Returns normally distributed random values bounded within a specified range https://en.wikipedia.org/wiki/Truncated_normal_distribution

    Inherited Members
    ValueType.Equals(Object)
    ValueType.GetHashCode()
    ValueType.ToString()
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetType()
    Namespace: UnityEngine.Experimental.Perception.Randomization.Samplers
    Syntax
    [Serializable]
    public struct NormalSampler : ISampler

    Constructors

    NormalSampler(Single, Single, Single, Single, UInt32)

    Constructs a normal distribution sampler

    Declaration
    public NormalSampler(float min, float max, float mean, float standardDeviation, uint baseSeed = 539662031U)
    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

    UInt32 baseSeed

    The base random seed to use for this sampler

    Fields

    mean

    The mean of the normal distribution to sample from

    Declaration
    public float mean
    Field Value
    Type Description
    Single

    standardDeviation

    The standard deviation of the normal distribution to sample from

    Declaration
    public float standardDeviation
    Field Value
    Type Description
    Single

    Properties

    baseSeed

    The base seed used to initialize this sampler's state

    Declaration
    public uint baseSeed { get; set; }
    Property Value
    Type Description
    UInt32
    Implements
    ISampler.baseSeed

    range

    A range bounding the values generated by this sampler

    Declaration
    public FloatRange range { get; set; }
    Property Value
    Type Description
    FloatRange
    Implements
    ISampler.range

    state

    The current random state of this sampler

    Declaration
    public uint state { get; set; }
    Property Value
    Type Description
    UInt32
    Implements
    ISampler.state

    Methods

    IterateState(Int32)

    Deterministically offsets a sampler's state

    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
    ISampler.IterateState(Int32)

    ResetState()

    Resets a sampler's state to its base random seed

    Declaration
    public void ResetState()
    Implements
    ISampler.ResetState()

    Sample()

    Generates one sample

    Declaration
    public float Sample()
    Returns
    Type Description
    Single

    The generated sample

    Implements
    ISampler.Sample()

    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

    Implements
    ISampler.Samples(Int32, out JobHandle)
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023