From 8aebef2459af9544dc1e51bf84231bca1724738f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20W=C3=BCrtz?= Date: Sat, 28 Dec 2019 13:34:08 +0100 Subject: [PATCH] Use global RNG for training RTrees. --- modules/ml/src/rtrees.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/ml/src/rtrees.cpp b/modules/ml/src/rtrees.cpp index f7a3a5b0fb..27ec096bc0 100644 --- a/modules/ml/src/rtrees.cpp +++ b/modules/ml/src/rtrees.cpp @@ -90,12 +90,12 @@ public: CV_TRACE_FUNCTION(); DTreesImpl::clear(); oobError = 0.; - rng = RNG((uint64)-1); } const vector& getActiveVars() CV_OVERRIDE { CV_TRACE_FUNCTION(); + RNG &rng = theRNG(); int i, nvars = (int)allVars.size(), m = (int)activeVars.size(); for( i = 0; i < nvars; i++ ) { @@ -134,6 +134,7 @@ public: bool train( const Ptr& trainData, int flags ) CV_OVERRIDE { CV_TRACE_FUNCTION(); + RNG &rng = theRNG(); CV_Assert(!trainData.empty()); startTraining(trainData, flags); int treeidx, ntrees = (rparams.termCrit.type & TermCriteria::COUNT) != 0 ? @@ -424,7 +425,6 @@ public: double oobError; vector varImportance; vector allVars, activeVars; - RNG rng; };