Auxiliary data structure for randomisation of indices.
More...
#include <JRandomTimeslice.hh>
|
void | random_shuffle (const int i1, const int i2) |
| Randomly shuffle values between given indices.
|
|
Auxiliary data structure for randomisation of indices.
Definition at line 166 of file JRandomTimeslice.hh.
◆ random_indices_t()
KM3NETDAQ::JRandomTimeslice::random_indices_t::random_indices_t |
( |
const size_t | N | ) |
|
|
inline |
◆ random_shuffle() [1/2]
void KM3NETDAQ::JRandomTimeslice::random_indices_t::random_shuffle |
( |
const std::set< size_t > & | keep | ) |
|
|
inline |
Randomly shuffle values between fixed indices.
- Parameters
-
Definition at line 183 of file JRandomTimeslice.hh.
184 {
185 for (size_t i = 0; i != this->size(); ++i) {
186 (*this)[i] = i;
187 }
188
189 size_t i1 = 0;
190
191 for (const size_t i2 : keep) {
192
194
195 i1 = i2 + 1;
196 }
197
199 }
void random_shuffle(const std::set< size_t > &keep)
Randomly shuffle values between fixed indices.
◆ random_shuffle() [2/2]
void KM3NETDAQ::JRandomTimeslice::random_indices_t::random_shuffle |
( |
const int | i1, |
|
|
const int | i2 ) |
|
inlineprivate |
Randomly shuffle values between given indices.
- Parameters
-
i1 | first index (included) |
i2 | last index (excluded) |
Definition at line 208 of file JRandomTimeslice.hh.
209 {
210 for (int i = i2 - 1; i > i1; --i) {
211
212 const int l = i1 + gRandom->Integer(i - i1);
213
214 std::swap((*this)[i], (*this)[l]);
215 }
216 }
The documentation for this struct was generated from the following file: