From c43fac4dcf1357dee0745adfe636c50ab64a9576 Mon Sep 17 00:00:00 2001 From: Adrian Mariano Date: Sat, 26 Mar 2022 22:38:04 -0400 Subject: [PATCH] handle zero case --- math.scad | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/math.scad b/math.scad index 6e51ae1..e458bec 100644 --- a/math.scad +++ b/math.scad @@ -581,7 +581,7 @@ function exponential_rands(n=1, lambda=1, seed) = let( unif = is_def(seed) ? rands(0,1,n,seed=seed) : rands(0,1,n) ) - -(1/lambda) * [for(x=unif) ln(1-x)]; + -(1/lambda) * [for(x=unif) x==1 ? 708.3964185322641 : ln(1-x)]; // Use ln(min_float) when x is 1 // Function: spherical_random_points() // Usage: