From f4bc76e5fd936836019596895137bcaf45da7131 Mon Sep 17 00:00:00 2001 From: jmmuller Date: Wed, 23 Oct 2024 11:52:01 +0200 Subject: [PATCH] RandInInterval(cPt2dr) --- MMVII/include/MMVII_nums.h | 1 + MMVII/src/UtiMaths/uti_rand.cpp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/MMVII/include/MMVII_nums.h b/MMVII/include/MMVII_nums.h index b804c3d4a4..4494136ca1 100755 --- a/MMVII/include/MMVII_nums.h +++ b/MMVII/include/MMVII_nums.h @@ -70,6 +70,7 @@ double RandUnif_N(int aN); ///< Uniform disrtibution in [0,N[ double RandUnif_C_NotNull(double aEps); ///< Uniform distribution in -1 1, but abs > aEps double RandUnif_NotNull(double aEps); ///< Uniform distribution in 0 1, but abs > aEps double RandInInterval(double a,double b); ///< Uniform distribution in [a,b] +double RandInInterval(const cPt2dr &interval); ///< Uniform distribution in [interval.x,interval.y] /** Class for mapping object R->R */ class cFctrRR diff --git a/MMVII/src/UtiMaths/uti_rand.cpp b/MMVII/src/UtiMaths/uti_rand.cpp index 337ddab56a..b7f6b7920b 100755 --- a/MMVII/src/UtiMaths/uti_rand.cpp +++ b/MMVII/src/UtiMaths/uti_rand.cpp @@ -203,6 +203,10 @@ double RandInInterval(double a,double b) return b+ (a-b) * RandUnif_0_1() ; } +double RandInInterval(const cPt2dr &interval) +{ + return RandInInterval(interval.x(), interval.y()); +} double RandUnif_C_NotNull(double aEps) {