浏览代码

math: allow rand(0), it’s arguably better than raising SIGFPE.

undefined
Sam Hocevar 9 年前
父节点
当前提交
2e997f24f1
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. +1
    -1
      src/lol/math/rand.h

+ 1
- 1
src/lol/math/rand.h 查看文件

@@ -29,7 +29,7 @@ template<typename T> static inline T rand(T a, T b);
/* One-value random number generators */
template<typename T> static inline T rand(T a)
{
return rand<T>() % a;
return a ? rand<T>() % a : T(0);
}

template<> inline half rand<half>(half a)


正在加载...
取消
保存