Skip to content

Commit

Permalink
fix corner case
Browse files Browse the repository at this point in the history
  • Loading branch information
teuben committed Dec 26, 2024
1 parent 48e8f6b commit 7768489
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/kernel/misc/xrandom.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ double xrandom(double xl, double xh)
{
double retval;

if (xl==xh) return xl;

for(;;) {
#if defined(HAVE_GSL)
if (my_r == NULL) error("GSL init_xrandom was never called");
Expand Down Expand Up @@ -237,6 +239,8 @@ double grandom(double mean, double sdev)
static double v1, v2, s;
static int gcount = 0;

if (sdev <= 0) return mean;

if (gcount) {
gcount = 0;
return mean + sdev * v2 * s;
Expand Down

0 comments on commit 7768489

Please sign in to comment.