namespace UnityEngine.Rendering
{
///
/// An utility class to compute samples on the Halton sequence.
/// https://en.wikipedia.org/wiki/Halton_sequence
///
public static class HaltonSequence
{
///
/// Gets a deterministic sample in the Halton sequence.
///
/// The index in the sequence.
/// The radix of the sequence.
/// A sample from the Halton sequence.
public static float Get(int index, int radix)
{
float result = 0f;
float fraction = 1f / radix;
while (index > 0)
{
result += (index % radix) * fraction;
index /= radix;
fraction /= radix;
}
return result;
}
}
}