浏览代码

Update CategoricalParameter.cs

/fix_sampler_rounding_issue
Mohsen Kamalzadeh 4 年前
当前提交
7920763e
共有 1 个文件被更改,包括 11 次插入3 次删除
  1. 14
      com.unity.perception/Runtime/Randomization/Parameters/CategoricalParameter.cs

14
com.unity.perception/Runtime/Randomization/Parameters/CategoricalParameter.cs


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);
if (index == m_Categories.Count)
{
index--;
}
return m_Categories[index];
}
return m_Categories[BinarySearch(randomValue)];
}
/// <summary>

正在加载...
取消
保存