From 35e6aaad501523b21b9b50326375e2211850224b Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Tue, 24 Nov 2026 11:41:17 +0100 Subject: [PATCH] STYLE: Remove static_cast from randomSeed in ElastixBase BeforeAllBase() Following C++ Core Guidelines, Jun 14, 2026, "Avoid casts", https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#res-casts Used brace-initialization to ensure that the conversion from 121212 is lossless. --- Core/Kernel/elxElastixBase.cxx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Core/Kernel/elxElastixBase.cxx b/Core/Kernel/elxElastixBase.cxx index a3ec2e664..d4361f248 100644 --- a/Core/Kernel/elxElastixBase.cxx +++ b/Core/Kernel/elxElastixBase.cxx @@ -285,11 +285,9 @@ ElastixBase::BeforeAllBase() * the default in the MersenneTwister code. * Use silent parameter file readout, to avoid annoying warning when * starting elastix */ - using RandomGeneratorType = itk::Statistics::MersenneTwisterRandomVariateGenerator; - using SeedType = RandomGeneratorType::IntegerType; - unsigned int randomSeed = 121212; + itk::Statistics::MersenneTwisterRandomVariateGenerator::IntegerType randomSeed{ 121212 }; m_Configuration->ReadParameter(randomSeed, "RandomSeed", 0, false); - m_RandomVariateGenerator.SetSeed(static_cast(randomSeed)); + m_RandomVariateGenerator.SetSeed(randomSeed); /** Return a value. */ return returndummy;