diff --git a/Modules/Core/ImageAdaptors/test/itkComplexConjugateImageAdaptorTest.cxx b/Modules/Core/ImageAdaptors/test/itkComplexConjugateImageAdaptorTest.cxx index f31179f42db..2625218503d 100644 --- a/Modules/Core/ImageAdaptors/test/itkComplexConjugateImageAdaptorTest.cxx +++ b/Modules/Core/ImageAdaptors/test/itkComplexConjugateImageAdaptorTest.cxx @@ -18,6 +18,7 @@ #include "itkComplexConjugateImageAdaptor.h" #include "itkImageRegionIterator.h" +#include using PixelType = std::complex; @@ -34,13 +35,13 @@ itkComplexConjugateImageAdaptorTest(int, char *[]) image->Allocate(); const ImageType::RegionType region = image->GetLargestPossibleRegion(); - srand(50L); + std::mt19937 randomNumberEngine; + std::uniform_real_distribution randomNumberDistribution; itk::ImageRegionIterator iter(image, region); for (iter.GoToBegin(); !iter.IsAtEnd(); ++iter) { - auto randMax = static_cast(RAND_MAX); - const PixelType pixel(static_cast(rand()) / randMax, static_cast(rand()) / randMax); + const PixelType pixel(randomNumberDistribution(randomNumberEngine), randomNumberDistribution(randomNumberEngine)); iter.Set(pixel); }