From 56d873f2c3b701470088a7c16a6bfe644372e1f5 Mon Sep 17 00:00:00 2001 From: Tao Lv Date: Sun, 16 Feb 2020 23:21:06 +0800 Subject: [PATCH] address review comments --- tests/cpp/include/test_mkldnn.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/cpp/include/test_mkldnn.h b/tests/cpp/include/test_mkldnn.h index b727cd88a388..532f9a7e48b3 100644 --- a/tests/cpp/include/test_mkldnn.h +++ b/tests/cpp/include/test_mkldnn.h @@ -70,9 +70,9 @@ inline static void InitDefaultArray(NDArray *arr, bool is_rand = false, int max for (int i = 0; i < size; i++) if (is_rand) { - data[i] = (std::rand() % (max * 2)) - max; + data[i] = std::rand() * 1.0f / RAND_MAX * max * 2 - max; } else { - data[i] = i % (max * 2) - max; + data[i] = i * 1.0f / size * max * 2 - max; } }