您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
56 行
1.8 KiB
56 行
1.8 KiB
using System;
|
|
using Unity.Collections;
|
|
using Unity.Jobs;
|
|
using UnityEngine;
|
|
|
|
namespace UnityEngine.Experimental.Perception.Randomization.Samplers
|
|
{
|
|
/// <summary>
|
|
/// Generates random values from probability distributions
|
|
/// </summary>
|
|
public interface ISampler
|
|
{
|
|
/// <summary>
|
|
/// The base seed used to initialize this sampler's state
|
|
/// </summary>
|
|
uint baseSeed { get; set; }
|
|
|
|
/// <summary>
|
|
/// The current random state of this sampler
|
|
/// </summary>
|
|
uint state { get; set; }
|
|
|
|
/// <summary>
|
|
/// A range bounding the values generated by this sampler
|
|
/// </summary>
|
|
FloatRange range { get; set; }
|
|
|
|
/// <summary>
|
|
/// Resets a sampler's state to its base random seed
|
|
/// </summary>
|
|
void ResetState();
|
|
|
|
/// <summary>
|
|
/// Deterministically offsets a sampler's state when generating values within a batched job
|
|
/// </summary>
|
|
/// <param name="offsetIndex">
|
|
/// The index used to offset the sampler's state.
|
|
/// Typically set to either the current scenario iteration or a job's batch index.
|
|
/// </param>
|
|
void IterateState(int offsetIndex);
|
|
|
|
/// <summary>
|
|
/// Generates one sample
|
|
/// </summary>
|
|
/// <returns>The generated sample</returns>
|
|
float Sample();
|
|
|
|
/// <summary>
|
|
/// Schedules a job to generate an array of samples
|
|
/// </summary>
|
|
/// <param name="sampleCount">The number of samples to generate</param>
|
|
/// <param name="jobHandle">The handle of the scheduled job</param>
|
|
/// <returns>A NativeArray of generated samples</returns>
|
|
NativeArray<float> Samples(int sampleCount, out JobHandle jobHandle);
|
|
}
|
|
}
|