|
|
|
|
|
|
public T Sample() |
|
|
|
{ |
|
|
|
var randomValue = m_Sampler.Sample(); |
|
|
|
return uniform |
|
|
|
? m_Categories[(int)(randomValue * m_Categories.Count)] |
|
|
|
: m_Categories[BinarySearch(randomValue)]; |
|
|
|
if (uniform) |
|
|
|
{ |
|
|
|
var index = (int)(randomValue * m_Categories.Count); |
|
|
|
index = index == m_Categories.Count ? index - 1 : index; |
|
|
|
return m_Categories[index]; |
|
|
|
} |
|
|
|
return m_Categories[BinarySearch(randomValue)]; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|