diff options
author | Erik Schnetter <schnetter@gmail.com> | 2013-07-11 15:15:21 -0400 |
---|---|---|
committer | Erik Schnetter <schnetter@gmail.com> | 2013-07-11 15:15:21 -0400 |
commit | 306327851d0f3f28b33459ac29b4318a6ee4bcfc (patch) | |
tree | 5492c2b41f6afd223a5a0744d16d74c135d2f06b /Carpet/LoopControl | |
parent | c024f7e97655c2daf25fdcd18ddc8ee48b7bd412 (diff) |
LoopControl: Use random() instead of rand()
Diffstat (limited to 'Carpet/LoopControl')
-rw-r--r-- | Carpet/LoopControl/src/loopcontrol.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Carpet/LoopControl/src/loopcontrol.cc b/Carpet/LoopControl/src/loopcontrol.cc index fab467f28..a995abc51 100644 --- a/Carpet/LoopControl/src/loopcontrol.cc +++ b/Carpet/LoopControl/src/loopcontrol.cc @@ -283,8 +283,11 @@ namespace { T randomui(const T imin, const T imax, const T istr = 1) { assert(imin<imax); + // const T res = + // imin + istr * floor(rand() / (RAND_MAX + 1.0) * (imax - imin) / istr); const T res = - imin + istr * floor(rand() / (RAND_MAX + 1.0) * (imax - imin) / istr); + imin + + istr * llrint(floor(random() / (RAND_MAX + 1.0) * (imax - imin) / istr)); assert(res>=imin and res<imax and (res-imin) % istr == 0); return res; } @@ -673,7 +676,7 @@ void lc_control_init(lc_control_t *restrict const control, cctkGH->cctk_iteration < explore_eagerly_before_iteration; #endif if (lc_do_explore_eagerly or - rand() / (RAND_MAX + 1.0) < random_jump_probability) + random() / (RAND_MAX + 1.0) < random_jump_probability) { choice = choice_random_jump; } |