root/root-RF-Use-TRandom3-in-test-RooFuncWrapper.patch
2026-01-12 00:03:45 +01:00

50 lines
1.5 KiB
Diff

From e1f42658629ad67ce7cb224a1379d133f61f2e35 Mon Sep 17 00:00:00 2001
From: Jonas Rembser <jonas.rembser@cern.ch>
Date: Sun, 11 Jan 2026 10:25:51 +0100
Subject: [PATCH] [RF] Use TRandom3 in test RooFuncWrapper
Use TRandom3 instead of the `<random>` to get compiler-independent,
reproducible behavior.
---
roofit/roofitcore/test/testRooFuncWrapper.cxx | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/roofit/roofitcore/test/testRooFuncWrapper.cxx b/roofit/roofitcore/test/testRooFuncWrapper.cxx
index 2ebdf95333f..189e8f2e266 100644
--- a/roofit/roofitcore/test/testRooFuncWrapper.cxx
+++ b/roofit/roofitcore/test/testRooFuncWrapper.cxx
@@ -34,12 +34,12 @@
#include <RooWorkspace.h>
#include <ROOT/StringUtils.hxx>
+#include <TMath.h>
#include <TROOT.h>
+#include <TRandom3.h>
#include <TSystem.h>
-#include <TMath.h>
#include <functional>
-#include <random>
#include "gtest_wrapper.h"
@@ -66,13 +66,13 @@ double getNumDerivative(const RooAbsReal &pdf, RooRealVar &var, const RooArgSet
void randomizeParameters(const RooArgSet &parameters)
{
+ TRandom3 rng(1337);
+
double lowerBound = -0.1;
double upperBound = 0.1;
- std::uniform_real_distribution<double> unif(lowerBound, upperBound);
- std::default_random_engine re;
for (auto *param : parameters) {
- double mul = unif(re);
+ double mul = rng.Uniform(lowerBound, upperBound);
auto par = dynamic_cast<RooAbsRealLValue *>(param);
if (!par)
--
2.52.0