From f28b353d190bd0a97b192a9dd484ce7a1c038df2 Mon Sep 17 00:00:00 2001 From: Cary Phillips Date: Tue, 10 Sep 2019 17:26:57 -0700 Subject: [PATCH] Changed rand() to in HalfTest/testError.cpp Signed-off-by: Cary Phillips --- IlmBase/HalfTest/testError.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/IlmBase/HalfTest/testError.cpp b/IlmBase/HalfTest/testError.cpp index ac813a88..9faeb093 100644 --- a/IlmBase/HalfTest/testError.cpp +++ b/IlmBase/HalfTest/testError.cpp @@ -12,7 +12,7 @@ #include #include #include - +#include using namespace std; @@ -21,7 +21,10 @@ namespace { float drand() { - return static_cast (rand()/(RAND_MAX+1.0f)); + static std::default_random_engine generator; + static std::uniform_real_distribution distribution (0.0f, 1.0f); + float r = distribution (generator); + return r; } } // namespace