mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-29 08:34:37 +08:00
Deal with zero sized ranges in Uniform correctly.
Change-Id: I6d5c622869e4795c252fa5c26fffbe4844abc3c9
This commit is contained in:
@@ -43,7 +43,11 @@ inline void SetRandomState(int state) {
|
||||
}
|
||||
|
||||
inline int Uniform(int n) {
|
||||
return rand() % n;
|
||||
if (n) {
|
||||
return rand() % n;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
inline double RandDouble() {
|
||||
|
||||
Reference in New Issue
Block a user