소스 검색

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 */ /* One-value random number generators */
template<typename T> static inline T rand(T a) 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) template<> inline half rand<half>(half a)


불러오는 중...
취소
저장