From 797249bf725051a07ad128b27a7f01d7be86f01c Mon Sep 17 00:00:00 2001 From: Andrej Rode Date: Fri, 16 Dec 2016 17:42:40 -0800 Subject: utils: tests: cast RAND_MAX to double before division --- host/utils/converter_benchmark.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'host/utils') diff --git a/host/utils/converter_benchmark.cpp b/host/utils/converter_benchmark.cpp index c0cd28440..f6d7e9650 100644 --- a/host/utils/converter_benchmark.cpp +++ b/host/utils/converter_benchmark.cpp @@ -82,8 +82,8 @@ void init_random_vector_complex_float(std::vector &buf_ptr, const size_t n std::complex * const buf = reinterpret_cast * const>(&buf_ptr[0]); for (size_t i = 0; i < n_items; i++) { buf[i] = std::complex( - T((std::rand()/double(RAND_MAX/2)) - 1), - T((std::rand()/double(RAND_MAX/2)) - 1) + T(std::rand()/(RAND_MAX/2.0) - 1), + T(std::rand()/(RAND_MAX/2.0) - 1) ); } } -- cgit v1.2.3