Skip to content

Commit

Permalink
[tools] rand_in_bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonRohou committed Jun 11, 2020
1 parent 962c219 commit 193bc95
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/tools/tubex_Tools.cpp
Expand Up @@ -50,6 +50,6 @@ namespace tubex
{
// The seed of the pseudo-random number generator is voluntarily initialized
// outside this function, on demand.
return rand()/double(RAND_MAX)*itv.diam()+itv.lb();
return max(itv.lb(),min(itv.ub(),rand()/double(RAND_MAX)*itv.diam()+itv.lb()));
}
}

0 comments on commit 193bc95

Please sign in to comment.