Skip to content

Commit 5f011c8

Browse files
authored
Merge pull request #5288 from N-Dekker/MersenneTwisterRandomVariateGenerator-avoid-protected-data
Avoid protected data MersenneTwisterRandomVariateGenerator
2 parents db10423 + 4246c00 commit 5f011c8

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

Modules/Core/Common/include/itkMersenneTwisterRandomVariateGenerator.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,6 @@ class ITKCommon_EXPORT MersenneTwisterRandomVariateGenerator : public RandomVari
268268
void
269269
PrintSelf(std::ostream & os, Indent indent) const override;
270270

271-
/** Period parameter */
272-
static constexpr unsigned int M = 397;
273-
274271
/** Reload array with N new values. */
275272
void
276273
reload();
@@ -305,6 +302,14 @@ class ITKCommon_EXPORT MersenneTwisterRandomVariateGenerator : public RandomVari
305302
static IntegerType
306303
hash(time_t t, clock_t c);
307304

305+
private:
306+
/** Only used to synchronize the global variable across static libraries.*/
307+
itkGetGlobalDeclarationMacro(MersenneTwisterGlobals, PimplGlobals);
308+
309+
/** Internal method to actually create a new object. */
310+
static Pointer
311+
CreateInstance();
312+
308313
// Internal state
309314
IntegerType state[StateVectorLength];
310315

@@ -317,14 +322,6 @@ class ITKCommon_EXPORT MersenneTwisterRandomVariateGenerator : public RandomVari
317322
// Seed value
318323
std::atomic<IntegerType> m_Seed{};
319324

320-
private:
321-
/** Only used to synchronize the global variable across static libraries.*/
322-
itkGetGlobalDeclarationMacro(MersenneTwisterGlobals, PimplGlobals);
323-
324-
/** Internal method to actually create a new object. */
325-
static Pointer
326-
CreateInstance();
327-
328325
// Local lock to enable concurrent access to singleton
329326
std::mutex m_InstanceMutex{};
330327

@@ -364,6 +361,9 @@ MersenneTwisterRandomVariateGenerator::reload()
364361
// Made clearer and faster by Matthew Bellew
365362
// matthew dot bellew at home dot com
366363

364+
// Period parameter
365+
static constexpr unsigned int M = 397;
366+
367367
// get rid of VS warning
368368
constexpr auto index = int{ M } - int{ MersenneTwisterRandomVariateGenerator::StateVectorLength };
369369

0 commit comments

Comments
 (0)