From 0dc200d8da26a9a42281df160168fe905c6126d0 Mon Sep 17 00:00:00 2001 From: Gunhan Gulsoy Date: Fri, 1 Feb 2019 09:29:50 -0800 Subject: [PATCH] Remove call to std::random_shuffle. std::random_shuffle is removed in C++17, and is causing TF to be not buildable in such configurations. Helps with Issue #23561 PiperOrigin-RevId: 231984187 --- tensorflow/core/kernels/sdca_internal.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tensorflow/core/kernels/sdca_internal.cc b/tensorflow/core/kernels/sdca_internal.cc index 2bb2c0d91e9..cbc754af0e9 100644 --- a/tensorflow/core/kernels/sdca_internal.cc +++ b/tensorflow/core/kernels/sdca_internal.cc @@ -310,7 +310,10 @@ Status Examples::SampleAdaptiveProbabilities( void Examples::RandomShuffle() { std::iota(sampled_index_.begin(), sampled_index_.end(), 0); - std::random_shuffle(sampled_index_.begin(), sampled_index_.end()); + + std::random_device rd; + std::mt19937 rng(rd()); + std::shuffle(sampled_index_.begin(), sampled_index_.end(), rng); } // TODO(sibyl-Aix6ihai): Refactor/shorten this function.