67 boost::uint64_t m_numPermutationsProcessed{};
68 boost::minstd_rand m_rng;
69 std::vector<boost::random::uniform_int_distribution<>> m_distributions;
77 for (
size_t i = 0; i < m_permutation.size(); ++i) {
78 m_distributions.emplace_back(0, m_permutation[i] - 1);
82 using EnumerationStrategyBase::initialize;
86 m_distributions.clear();
87 for (
size_t i = 0; i < m_permutationSizes.size(); ++i) {
88 m_distributions.emplace_back(0, m_permutationSizes[i] - 1);
91 m_numPermutationsProcessed = 0;
94 const char *
type()
const override {
return "RandomSampleStrategy"; }
98 for (
size_t i = 0; i < m_permutation.size(); ++i) {
99 m_permutation[i] = m_distributions[i](m_rng);
102 ++m_numPermutationsProcessed;
104 return m_permutation;
108 return m_numPermutationsProcessed;
111 operator bool()
const override {
return true; }
118#ifdef RDK_USE_BOOST_SERIALIZATION
119 friend class boost::serialization::access;
121 template <
class Archive>
122 void save(Archive &ar,
const unsigned int )
const {
124 ar << boost::serialization::base_object<const EnumerationStrategyBase>(
126 ar << m_numPermutationsProcessed;
128 std::stringstream random;
130 std::string s = random.str();
134 template <
class Archive>
135 void load(Archive &ar,
const unsigned int ) {
137 ar >> boost::serialization::base_object<EnumerationStrategyBase>(*
this);
138 ar >> m_numPermutationsProcessed;
141 std::stringstream random(s);
145 m_distributions.clear();
146 for (
size_t i = 0; i < m_permutationSizes.size(); ++i) {
147 m_distributions.emplace_back(0, m_permutationSizes[i] - 1);
151 template <
class Archive>
152 void serialize(Archive &ar,
const unsigned int file_version) {
153 boost::serialization::split_member(ar, *
this, file_version);