@@ -246,12 +246,12 @@ namespace ompl
246246
247247#ifdef GNAT_SAMPLER
248248 // / Sample an element from the GNAT.
249- const _T& sample () const
249+ const _T& sample (RNG& rng ) const
250250 {
251251 if (!size ())
252252 throw Exception (" Cannot sample from an empty tree" );
253253 else
254- return tree_->sample (*this );
254+ return tree_->sample (*this , rng );
255255 }
256256#endif
257257
@@ -665,20 +665,20 @@ namespace ompl
665665 minR = std::max (minR, maxRadius_);
666666 return std::pow (minR, gnat.estimatedDimension_ ) / (double ) subtreeSize_;
667667 }
668- const _T& sample (const GNAT& gnat) const
668+ const _T& sample (const GNAT& gnat, RNG& rng ) const
669669 {
670670 if (children_.size () != 0 )
671671 {
672- if (gnat. rng_ .uniform01 () < 1 ./(double ) subtreeSize_)
672+ if (rng .uniform01 () < 1 ./(double ) subtreeSize_)
673673 return pivot_;
674674 PDF<const Node*> distribution;
675675 for (unsigned int i = 0 ; i < children_.size (); ++i)
676676 distribution.add (children_[i], children_[i]->getSamplingWeight (gnat));
677- return distribution.sample (gnat. rng_ . uniform01 ())->sample (gnat);
677+ return distribution.sample (rng. uniform01 ())->sample (gnat, rng );
678678 }
679679 else
680680 {
681- unsigned int i = gnat. rng_ .uniformInt (0 , data_.size ());
681+ unsigned int i = rng .uniformInt (0 , data_.size ());
682682 return (i==data_.size ()) ? pivot_ : data_[i];
683683 }
684684 }
@@ -788,8 +788,6 @@ namespace ompl
788788#ifdef GNAT_SAMPLER
789789 // / \brief Estimated dimension of the local free space.
790790 double estimatedDimension_;
791- // / \brief Random number generator used to sample elements from the GNAT.
792- mutable RNG rng_;
793791#endif
794792 };
795793
0 commit comments