From befc9896d0f699163e6c252771ef3f4234b48f3b Mon Sep 17 00:00:00 2001 From: Nathan Sashihara <21227491+n8sh@users.noreply.github.com> Date: Tue, 9 Jan 2018 15:05:59 -0500 Subject: [PATCH] Fix Issue 18217: Don't repeatedly call unpredictableSeed to initialize rndGen Explanation: https://github.com/dlang/phobos/pull/5788#discussion_r146110307 --- std/random.d | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/std/random.d b/std/random.d index 5741b8e868c..4a493f78585 100644 --- a/std/random.d +++ b/std/random.d @@ -1357,8 +1357,8 @@ A singleton instance of the default random number generator static bool initialized; if (!initialized) { - static if (isSeedable!(Random, typeof(map!((a) => unpredictableSeed)(repeat(0))))) - result.seed(map!((a) => unpredictableSeed)(repeat(0))); + static if (isSeedable!(Random, ReturnType!unpredictableSeed)) + result.seed(unpredictableSeed); // Avoid unnecessary copy. else result = Random(unpredictableSeed); initialized = true;