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

    Class SamplerUtility

    A set of utility functions for defining sampler interfaces

    Inheritance
    Object
    SamplerUtility
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: UnityEngine.Experimental.Perception.Randomization.Samplers
    Syntax
    public static class SamplerUtility

    Methods

    GenerateRandomSeed()

    Non-deterministically generates a non-zero random seed

    Declaration
    public static uint GenerateRandomSeed()
    Returns
    Type Description
    UInt32

    A non-deterministically generated random seed

    GenerateSamples<T>(T, Int32, out JobHandle)

    Schedules a multi-threaded job to generate an array of samples

    Declaration
    public static NativeArray<float> GenerateSamples<T>(T sampler, int sampleCount, out JobHandle jobHandle)
        where T : struct, ISampler
    Parameters
    Type Name Description
    T sampler

    The sampler to generate samples from

    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

    Type Parameters
    Name Description
    T

    The type of sampler to sample

    GetSamplerDisplayName(Type)

    Returns the sampler's display name

    Declaration
    public static string GetSamplerDisplayName(Type samplerType)
    Parameters
    Type Name Description
    Type samplerType

    The sampler type

    Returns
    Type Description
    String

    The display name

    IterateSeed(UInt32, UInt32)

    Generates new a new non-zero random state by deterministically hashing a base seed with an iteration index

    Declaration
    public static uint IterateSeed(uint index, uint baseSeed)
    Parameters
    Type Name Description
    UInt32 index

    Usually the current scenario iteration or framesSinceInitialization

    UInt32 baseSeed

    The seed to be offset

    Returns
    Type Description
    UInt32

    A new random state

    TruncatedNormalSample(Single, Single, Single, Single, Single)

    Generates samples from a truncated normal distribution. Further reading about this distribution can be found here: https://en.wikipedia.org/wiki/Truncated_normal_distribution

    Declaration
    public static float TruncatedNormalSample(float uniformSample, float min, float max, float mean, float stdDev)
    Parameters
    Type Name Description
    Single uniformSample

    A sample value between 0 and 1 generated from a uniform distribution

    Single min

    The minimum possible value to generate

    Single max

    The maximum possible value to generate

    Single mean

    The mean of the normal distribution

    Single stdDev

    The standard deviation of the normal distribution

    Returns
    Type Description
    Single

    A value sampled from a truncated normal distribution

    Exceptions
    Type Condition
    ArgumentException
    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