commit 80802ec9c8d00afb60791abddf4ba75614f21450
parent b806651d3333530688a25b9061d9ebc514ae776d
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Mon, 27 Nov 2017 16:21:43 +0100
Does not assert when 0 is submitted to the exp random variate
Diffstat:
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/ssp_ran.c b/src/ssp_ran.c
@@ -49,7 +49,7 @@ cosf2sinf(const float d)
double
ssp_ran_exp(struct ssp_rng* rng, const double mu)
{
- ASSERT(rng && mu > 0);
+ ASSERT(rng && mu >= 0);
rng_cxx rng_cxx(*rng);
RAN_NAMESPACE::exponential_distribution<double> distribution(mu);
return distribution(rng_cxx);
@@ -58,7 +58,7 @@ ssp_ran_exp(struct ssp_rng* rng, const double mu)
float
ssp_ran_exp_float(struct ssp_rng* rng, const float mu)
{
- ASSERT(rng && mu > 0);
+ ASSERT(rng && mu >= 0);
rng_cxx rng_cxx(*rng);
RAN_NAMESPACE::exponential_distribution<float> distribution(mu);
return distribution(rng_cxx);
@@ -67,14 +67,14 @@ ssp_ran_exp_float(struct ssp_rng* rng, const float mu)
double
ssp_ran_exp_pdf(const double x, const double mu)
{
- ASSERT(x >= 0 && mu > 0);
+ ASSERT(x >= 0 && mu >= 0);
return mu * exp(-x * mu);
}
float
ssp_ran_exp_float_pdf(const float x, const float mu)
{
- ASSERT(x >= 0 && mu > 0);
+ ASSERT(x >= 0 && mu >= 0);
return mu * expf(-x * mu);
}
@@ -490,4 +490,4 @@ ssp_ran_uniform_disk_float_local
pt[2] = 0;
if (pdf) *pdf = 1 / (radius * radius);
return pt;
-}
-\ No newline at end of file
+}