about summary refs log tree commit diff
path: root/absl/random
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2019-12-12T18·36-0800
committerMatt Calabrese <calabrese@x.team>2019-12-12T20·37-0500
commit12bc53e0318d80569270a5b26ccbc62b52022b89 (patch)
tree703f7dd5e7fdea7db3eefe317b10b1f67ddd8212 /absl/random
parent1e39f8626a4dadec1f56920b999dd4c3cfae333e (diff)
Export of internal Abseil changes
--
c99f979ad34f155fbeeea69b88bdc7458d89a21c by Derek Mauro <dmauro@google.com>:

Remove a floating point division by zero test.

This isn't testing behavior related to the library, and MSVC warns
about it in opt mode.

PiperOrigin-RevId: 285220804

--
68b015491f0dbf1ab547994673281abd1f34cd4b by Gennadiy Rozental <rogeeff@google.com>:

This CL introduces following changes to the class FlagImpl:
* We eliminate the CommandLineFlagLocks struct. Instead callback guard and callback function are combined into a single CallbackData struct, while primary data lock is stored separately.
* CallbackData member of class FlagImpl is initially set to be nullptr and is only allocated and initialized when a flag's callback is being set. For most flags we do not pay for the extra space and extra absl::Mutex now.
* Primary data guard is stored in data_guard_ data member. This is a properly aligned character buffer of necessary size. During initialization of the flag we construct absl::Mutex in this space using placement new call.
* We now avoid extra value copy after successful attempt to parse value out of string. Instead we swap flag's current value with tentative value we just produced.

PiperOrigin-RevId: 285132636

--
ed45d118fb818969eb13094cf7827c885dfc562c by Tom Manshreck <shreck@google.com>:

Change null-term* (and nul-term*) to NUL-term* in comments

PiperOrigin-RevId: 285036610

--
729619017944db895ce8d6d29c1995aa2e5628a5 by Derek Mauro <dmauro@google.com>:

Use the Posix implementation of thread identity on MinGW.
Some versions of MinGW suffer from thread_local bugs.

PiperOrigin-RevId: 285022920

--
39a25493503c76885bc3254c28f66a251c5b5bb0 by Greg Falcon <gfalcon@google.com>:

Implementation detail change.

Add further ABSL_NAMESPACE_BEGIN and _END annotation macros to files in Abseil.

PiperOrigin-RevId: 285012012
GitOrigin-RevId: c99f979ad34f155fbeeea69b88bdc7458d89a21c
Change-Id: I4c85d3704e45d11a9ac50d562f39640a6adbedc1
Diffstat (limited to 'absl/random')
-rw-r--r--absl/random/CMakeLists.txt14
-rw-r--r--absl/random/bernoulli_distribution.h2
-rw-r--r--absl/random/beta_distribution.h2
-rw-r--r--absl/random/bit_gen_ref.h2
-rw-r--r--absl/random/bit_gen_ref_test.cc2
-rw-r--r--absl/random/discrete_distribution.cc2
-rw-r--r--absl/random/discrete_distribution.h2
-rw-r--r--absl/random/distribution_format_traits.h2
-rw-r--r--absl/random/distributions.h2
-rw-r--r--absl/random/exponential_distribution.h2
-rw-r--r--absl/random/gaussian_distribution.cc2
-rw-r--r--absl/random/gaussian_distribution.h2
-rw-r--r--absl/random/internal/BUILD.bazel9
-rw-r--r--absl/random/internal/chi_square.cc2
-rw-r--r--absl/random/internal/chi_square.h4
-rw-r--r--absl/random/internal/distribution_caller.h4
-rw-r--r--absl/random/internal/distribution_test_util.cc2
-rw-r--r--absl/random/internal/distribution_test_util.h2
-rw-r--r--absl/random/internal/distributions.h2
-rw-r--r--absl/random/internal/explicit_seed_seq.h4
-rw-r--r--absl/random/internal/fast_uniform_bits.h4
-rw-r--r--absl/random/internal/fast_uniform_bits_test.cc2
-rw-r--r--absl/random/internal/fastmath.h2
-rw-r--r--absl/random/internal/gaussian_distribution_gentables.cc2
-rw-r--r--absl/random/internal/generate_real.h2
-rw-r--r--absl/random/internal/iostream_state_saver.h2
-rw-r--r--absl/random/internal/mock_overload_set.h2
-rw-r--r--absl/random/internal/mocking_bit_gen_base.h2
-rw-r--r--absl/random/internal/nanobenchmark.cc2
-rw-r--r--absl/random/internal/nanobenchmark.h4
-rw-r--r--absl/random/internal/nanobenchmark_test.cc2
-rw-r--r--absl/random/internal/nonsecure_base.h2
-rw-r--r--absl/random/internal/pcg_engine.h2
-rw-r--r--absl/random/internal/pool_urbg.cc2
-rw-r--r--absl/random/internal/pool_urbg.h2
-rw-r--r--absl/random/internal/randen.cc2
-rw-r--r--absl/random/internal/randen.h2
-rw-r--r--absl/random/internal/randen_detect.cc2
-rw-r--r--absl/random/internal/randen_detect.h4
-rw-r--r--absl/random/internal/randen_engine.h2
-rw-r--r--absl/random/internal/randen_hwaes.cc4
-rw-r--r--absl/random/internal/randen_hwaes.h4
-rw-r--r--absl/random/internal/randen_slow.cc2
-rw-r--r--absl/random/internal/randen_slow.h4
-rw-r--r--absl/random/internal/randen_traits.h4
-rw-r--r--absl/random/internal/salted_seed_seq.h2
-rw-r--r--absl/random/internal/seed_material.cc2
-rw-r--r--absl/random/internal/seed_material.h2
-rw-r--r--absl/random/internal/sequence_urbg.h4
-rw-r--r--absl/random/internal/traits.h2
-rw-r--r--absl/random/internal/uniform_helper.h2
-rw-r--r--absl/random/internal/wide_multiply.h2
-rw-r--r--absl/random/log_uniform_int_distribution.h2
-rw-r--r--absl/random/mock_distributions.h2
-rw-r--r--absl/random/mocking_bit_gen.cc2
-rw-r--r--absl/random/mocking_bit_gen.h2
-rw-r--r--absl/random/poisson_distribution.h2
-rw-r--r--absl/random/random.h2
-rw-r--r--absl/random/seed_gen_exception.cc2
-rw-r--r--absl/random/seed_gen_exception.h4
-rw-r--r--absl/random/seed_sequences.cc2
-rw-r--r--absl/random/seed_sequences.h2
-rw-r--r--absl/random/uniform_int_distribution.h2
-rw-r--r--absl/random/uniform_real_distribution.h2
-rw-r--r--absl/random/zipf_distribution.h2
65 files changed, 173 insertions, 0 deletions
diff --git a/absl/random/CMakeLists.txt b/absl/random/CMakeLists.txt
index 13e96357ffdd..46dbc3efbc83 100644
--- a/absl/random/CMakeLists.txt
+++ b/absl/random/CMakeLists.txt
@@ -526,6 +526,8 @@ absl_cc_library(
     ${ABSL_DEFAULT_COPTS}
   LINKOPTS
     ${ABSL_DEFAULT_LINKOPTS}
+  DEPS
+    absl::config
 )
 
 # Internal-only target, do not depend on directly.
@@ -559,6 +561,8 @@ absl_cc_library(
     ${ABSL_DEFAULT_COPTS}
   LINKOPTS
     ${ABSL_DEFAULT_LINKOPTS}
+  DEPS
+    absl::config
 )
 
 # Internal-only target, do not depend on directly.
@@ -618,6 +622,8 @@ absl_cc_library(
     ${ABSL_DEFAULT_COPTS}
   LINKOPTS
     ${ABSL_DEFAULT_LINKOPTS}
+  DEPS
+    absl::config
   TESTONLY
 )
 
@@ -631,6 +637,8 @@ absl_cc_library(
     ${ABSL_DEFAULT_COPTS}
   LINKOPTS
     ${ABSL_DEFAULT_LINKOPTS}
+  DEPS
+    absl::config
   TESTONLY
 )
 
@@ -782,6 +790,8 @@ absl_cc_library(
     ${ABSL_DEFAULT_COPTS}
   LINKOPTS
     ${ABSL_DEFAULT_LINKOPTS}
+  DEPS
+    absl::config
 )
 
 # Internal-only target, do not depend on directly.
@@ -816,6 +826,7 @@ absl_cc_library(
     ${ABSL_DEFAULT_LINKOPTS}
   DEPS
     absl::random_internal_platform
+    absl::config
 )
 
 # Internal-only target, do not depend on directly.
@@ -835,6 +846,7 @@ absl_cc_library(
   DEPS
     absl::random_internal_platform
     absl::random_internal_randen_hwaes_impl
+    absl::config
 )
 
 # Internal-only target, do not depend on directly.
@@ -851,6 +863,7 @@ absl_cc_library(
     ${ABSL_DEFAULT_LINKOPTS}
   DEPS
     absl::random_internal_platform
+    absl::config
 )
 
 # Internal-only target, do not depend on directly.
@@ -868,6 +881,7 @@ absl_cc_library(
   LINKOPTS
     ${ABSL_DEFAULT_LINKOPTS}
   DEPS
+    absl::config
     absl::core_headers
     absl::raw_logging_internal
     absl::strings
diff --git a/absl/random/bernoulli_distribution.h b/absl/random/bernoulli_distribution.h
index 326fcb6e012d..25bd0d5ca420 100644
--- a/absl/random/bernoulli_distribution.h
+++ b/absl/random/bernoulli_distribution.h
@@ -24,6 +24,7 @@
 #include "absl/random/internal/iostream_state_saver.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 
 // absl::bernoulli_distribution is a drop in replacement for
 // std::bernoulli_distribution. It guarantees that (given a perfect
@@ -193,6 +194,7 @@ bool bernoulli_distribution::Generate(double p,
   }
 }
 
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_BERNOULLI_DISTRIBUTION_H_
diff --git a/absl/random/beta_distribution.h b/absl/random/beta_distribution.h
index b09b02f0dde5..c154066fb813 100644
--- a/absl/random/beta_distribution.h
+++ b/absl/random/beta_distribution.h
@@ -29,6 +29,7 @@
 #include "absl/random/internal/iostream_state_saver.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 
 // absl::beta_distribution:
 // Generate a floating-point variate conforming to a Beta distribution:
@@ -420,6 +421,7 @@ std::basic_istream<CharT, Traits>& operator>>(
   return is;
 }
 
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_BETA_DISTRIBUTION_H_
diff --git a/absl/random/bit_gen_ref.h b/absl/random/bit_gen_ref.h
index 00e904f85ec3..e8771162e5fb 100644
--- a/absl/random/bit_gen_ref.h
+++ b/absl/random/bit_gen_ref.h
@@ -31,6 +31,7 @@
 #include "absl/random/internal/mocking_bit_gen_base.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 
 template <typename URBG, typename = void, typename = void, typename = void>
@@ -146,6 +147,7 @@ struct DistributionCaller<absl::BitGenRef> {
 };
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_BIT_GEN_REF_H_
diff --git a/absl/random/bit_gen_ref_test.cc b/absl/random/bit_gen_ref_test.cc
index bc02ca5c1621..ca0e4d707250 100644
--- a/absl/random/bit_gen_ref_test.cc
+++ b/absl/random/bit_gen_ref_test.cc
@@ -21,6 +21,7 @@
 #include "absl/random/random.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 
 class ConstBitGen : public absl::random_internal::MockingBitGenBase {
   bool CallImpl(const std::type_info&, void*, void* result) override {
@@ -96,4 +97,5 @@ TEST(BitGenRefTest, MockingBitGenBaseOverrides) {
   EXPECT_EQ(FnTest(gen_ref), 42);  // Copy
 }
 }  // namespace
+ABSL_NAMESPACE_END
 }  // namespace absl
diff --git a/absl/random/discrete_distribution.cc b/absl/random/discrete_distribution.cc
index e6c09c5180b3..081accee52a4 100644
--- a/absl/random/discrete_distribution.cc
+++ b/absl/random/discrete_distribution.cc
@@ -15,6 +15,7 @@
 #include "absl/random/discrete_distribution.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 
 // Initializes the distribution table for Walker's Aliasing algorithm, described
@@ -93,4 +94,5 @@ std::vector<std::pair<double, size_t>> InitDiscreteDistribution(
 }
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
diff --git a/absl/random/discrete_distribution.h b/absl/random/discrete_distribution.h
index 1560f03c5fdd..171aa11a1eb4 100644
--- a/absl/random/discrete_distribution.h
+++ b/absl/random/discrete_distribution.h
@@ -29,6 +29,7 @@
 #include "absl/random/uniform_int_distribution.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 
 // absl::discrete_distribution
 //
@@ -240,6 +241,7 @@ std::basic_istream<CharT, Traits>& operator>>(
   return is;
 }
 
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_DISCRETE_DISTRIBUTION_H_
diff --git a/absl/random/distribution_format_traits.h b/absl/random/distribution_format_traits.h
index f9f070589f00..22b358cc8c37 100644
--- a/absl/random/distribution_format_traits.h
+++ b/absl/random/distribution_format_traits.h
@@ -36,6 +36,7 @@
 #include "absl/types/span.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 
 struct IntervalClosedClosedTag;
 struct IntervalClosedOpenTag;
@@ -271,6 +272,7 @@ struct DistributionFormatTraits<UniformDistributionWrapper<NumType>> {
 };
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_DISTRIBUTION_FORMAT_TRAITS_H_
diff --git a/absl/random/distributions.h b/absl/random/distributions.h
index 6ced60616158..c1fb66501593 100644
--- a/absl/random/distributions.h
+++ b/absl/random/distributions.h
@@ -67,6 +67,7 @@
 #include "absl/random/zipf_distribution.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 
 ABSL_INTERNAL_INLINE_CONSTEXPR(IntervalClosedClosedTag, IntervalClosedClosed,
                                {});
@@ -458,6 +459,7 @@ IntType Zipf(URBG&& urbg,  // NOLINT(runtime/references)
       distribution_t, format_t>(&urbg, hi, q, v);
 }
 
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_DISTRIBUTIONS_H_
diff --git a/absl/random/exponential_distribution.h b/absl/random/exponential_distribution.h
index 24abf57e99d6..b5caf8a1e1f3 100644
--- a/absl/random/exponential_distribution.h
+++ b/absl/random/exponential_distribution.h
@@ -27,6 +27,7 @@
 #include "absl/random/internal/iostream_state_saver.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 
 // absl::exponential_distribution:
 // Generates a number conforming to an exponential distribution and is
@@ -158,6 +159,7 @@ std::basic_istream<CharT, Traits>& operator>>(
   return is;
 }
 
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_EXPONENTIAL_DISTRIBUTION_H_
diff --git a/absl/random/gaussian_distribution.cc b/absl/random/gaussian_distribution.cc
index 5dd846194141..c7a72cb2f61c 100644
--- a/absl/random/gaussian_distribution.cc
+++ b/absl/random/gaussian_distribution.cc
@@ -4,6 +4,7 @@
 #include "absl/random/gaussian_distribution.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 
 const gaussian_distribution_base::Tables
@@ -96,6 +97,7 @@ const gaussian_distribution_base::Tables
      0.9362826816850632339, 0.9635996931270905952, 1}};
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 // clang-format on
diff --git a/absl/random/gaussian_distribution.h b/absl/random/gaussian_distribution.h
index c299e9441c46..c1427b06d549 100644
--- a/absl/random/gaussian_distribution.h
+++ b/absl/random/gaussian_distribution.h
@@ -33,6 +33,7 @@
 #include "absl/random/internal/iostream_state_saver.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 
 // absl::gaussian_distribution_base implements the underlying ziggurat algorithm
@@ -267,6 +268,7 @@ inline double gaussian_distribution_base::zignor(
 }
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_GAUSSIAN_DISTRIBUTION_H_
diff --git a/absl/random/internal/BUILD.bazel b/absl/random/internal/BUILD.bazel
index 952929ea264d..d7ad4efec989 100644
--- a/absl/random/internal/BUILD.bazel
+++ b/absl/random/internal/BUILD.bazel
@@ -51,6 +51,7 @@ cc_library(
     visibility = [
         "//absl/random:__pkg__",
     ],
+    deps = ["//absl/base:config"],
 )
 
 cc_library(
@@ -78,6 +79,7 @@ cc_library(
     visibility = [
         "//absl/random:__pkg__",
     ],
+    deps = ["//absl/base:config"],
 )
 
 cc_library(
@@ -138,6 +140,7 @@ cc_library(
     ],
     copts = ABSL_DEFAULT_COPTS,
     linkopts = ABSL_DEFAULT_LINKOPTS,
+    deps = ["//absl/base:config"],
 )
 
 cc_library(
@@ -148,6 +151,7 @@ cc_library(
     ],
     copts = ABSL_DEFAULT_COPTS,
     linkopts = ABSL_DEFAULT_LINKOPTS,
+    deps = ["//absl/base:config"],
 )
 
 cc_library(
@@ -269,6 +273,7 @@ cc_library(
         "randen-keys.inc",
         "platform.h",
     ],
+    deps = ["//absl/base:config"],
 )
 
 cc_library(
@@ -297,6 +302,7 @@ cc_library(
     linkopts = ABSL_DEFAULT_LINKOPTS,
     deps = [
         ":platform",
+        "//absl/base:config",
         "//absl/base:core_headers",
     ],
 )
@@ -317,6 +323,7 @@ cc_library(
     deps = [
         ":platform",
         ":randen_hwaes_impl",
+        "//absl/base:config",
     ],
 )
 
@@ -338,6 +345,7 @@ cc_library(
     linkopts = ABSL_DEFAULT_LINKOPTS,
     deps = [
         ":platform",
+        "//absl/base:config",
         "//absl/base:core_headers",
     ],
 )
@@ -368,6 +376,7 @@ cc_library(
     copts = ABSL_DEFAULT_COPTS,
     linkopts = ABSL_DEFAULT_LINKOPTS,
     deps = [
+        "//absl/base:config",
         "//absl/base:core_headers",
         "//absl/base:raw_logging_internal",
         "//absl/strings",
diff --git a/absl/random/internal/chi_square.cc b/absl/random/internal/chi_square.cc
index c0acc9477883..640d48cea6f4 100644
--- a/absl/random/internal/chi_square.cc
+++ b/absl/random/internal/chi_square.cc
@@ -19,6 +19,7 @@
 #include "absl/random/internal/distribution_test_util.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 namespace {
 
@@ -227,4 +228,5 @@ double ChiSquarePValue(double chi_square, int dof) {
 }
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
diff --git a/absl/random/internal/chi_square.h b/absl/random/internal/chi_square.h
index fa8646f274cd..07f4fbe52298 100644
--- a/absl/random/internal/chi_square.h
+++ b/absl/random/internal/chi_square.h
@@ -26,7 +26,10 @@
 
 #include <cassert>
 
+#include "absl/base/config.h"
+
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 
 constexpr const char kChiSquared[] = "chi-squared";
@@ -80,6 +83,7 @@ double ChiSquareValue(int dof, double p);
 double ChiSquarePValue(double chi_square, int dof);
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_INTERNAL_CHI_SQUARE_H_
diff --git a/absl/random/internal/distribution_caller.h b/absl/random/internal/distribution_caller.h
index 0318e1f8072e..02603cf84355 100644
--- a/absl/random/internal/distribution_caller.h
+++ b/absl/random/internal/distribution_caller.h
@@ -19,7 +19,10 @@
 
 #include <utility>
 
+#include "absl/base/config.h"
+
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 
 // DistributionCaller provides an opportunity to overload the general
@@ -51,6 +54,7 @@ struct DistributionCaller {
 };
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_INTERNAL_DISTRIBUTION_CALLER_H_
diff --git a/absl/random/internal/distribution_test_util.cc b/absl/random/internal/distribution_test_util.cc
index 85c8d596ebf8..e9005658c0a7 100644
--- a/absl/random/internal/distribution_test_util.cc
+++ b/absl/random/internal/distribution_test_util.cc
@@ -25,6 +25,7 @@
 #include "absl/strings/str_format.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 namespace {
 
@@ -413,4 +414,5 @@ double MaxErrorTolerance(double acceptance_probability) {
 }
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
diff --git a/absl/random/internal/distribution_test_util.h b/absl/random/internal/distribution_test_util.h
index b5ba49fa7e1e..6d94cf6c97bf 100644
--- a/absl/random/internal/distribution_test_util.h
+++ b/absl/random/internal/distribution_test_util.h
@@ -26,6 +26,7 @@
 // non-test code.
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 
 // http://webspace.ship.edu/pgmarr/Geo441/Lectures/Lec%205%20-%20Normality%20Testing.pdf
@@ -106,6 +107,7 @@ double BetaIncomplete(double x, double p, double q);
 double BetaIncompleteInv(double p, double q, double alpha);
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_INTERNAL_DISTRIBUTION_TEST_UTIL_H_
diff --git a/absl/random/internal/distributions.h b/absl/random/internal/distributions.h
index c8cec02b7fbc..d7e3c0161f06 100644
--- a/absl/random/internal/distributions.h
+++ b/absl/random/internal/distributions.h
@@ -23,6 +23,7 @@
 #include "absl/random/internal/uniform_helper.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 
 // In the absence of an explicitly provided return-type, the template
@@ -45,6 +46,7 @@ using uniform_inferred_return_t =
                           is_widening_convertible<A, B>::value, B, A>::type>;
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_INTERNAL_DISTRIBUTIONS_H_
diff --git a/absl/random/internal/explicit_seed_seq.h b/absl/random/internal/explicit_seed_seq.h
index b660ece50017..6a743eaf46cc 100644
--- a/absl/random/internal/explicit_seed_seq.h
+++ b/absl/random/internal/explicit_seed_seq.h
@@ -22,7 +22,10 @@
 #include <iterator>
 #include <vector>
 
+#include "absl/base/config.h"
+
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 
 // This class conforms to the C++ Standard "Seed Sequence" concept
@@ -82,6 +85,7 @@ class ExplicitSeedSeq {
 };
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_INTERNAL_EXPLICIT_SEED_SEQ_H_
diff --git a/absl/random/internal/fast_uniform_bits.h b/absl/random/internal/fast_uniform_bits.h
index e8df92f3d99f..f13c8729f7c8 100644
--- a/absl/random/internal/fast_uniform_bits.h
+++ b/absl/random/internal/fast_uniform_bits.h
@@ -20,7 +20,10 @@
 #include <limits>
 #include <type_traits>
 
+#include "absl/base/config.h"
+
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 // Returns true if the input value is zero or a power of two. Useful for
 // determining if the range of output values in a URBG
@@ -255,6 +258,7 @@ FastUniformBits<UIntType>::Generate(URBG& g,  // NOLINT(runtime/references)
 }
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_INTERNAL_FAST_UNIFORM_BITS_H_
diff --git a/absl/random/internal/fast_uniform_bits_test.cc b/absl/random/internal/fast_uniform_bits_test.cc
index 9f2e82687dd6..f5b837e5861b 100644
--- a/absl/random/internal/fast_uniform_bits_test.cc
+++ b/absl/random/internal/fast_uniform_bits_test.cc
@@ -19,6 +19,7 @@
 #include "gtest/gtest.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 namespace {
 
@@ -269,4 +270,5 @@ TEST(FastUniformBitsTest, URBG32bitRegression) {
 
 }  // namespace
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
diff --git a/absl/random/internal/fastmath.h b/absl/random/internal/fastmath.h
index 4bd184105399..6baeb5a7c917 100644
--- a/absl/random/internal/fastmath.h
+++ b/absl/random/internal/fastmath.h
@@ -25,6 +25,7 @@
 #include "absl/base/internal/bits.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 
 // Returns the position of the first bit set.
@@ -67,6 +68,7 @@ inline constexpr uint64_t rotr(uint64_t value, uint8_t bits) {
 }
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_INTERNAL_FASTMATH_H_
diff --git a/absl/random/internal/gaussian_distribution_gentables.cc b/absl/random/internal/gaussian_distribution_gentables.cc
index 16a23cb2f91f..a2bf03940f67 100644
--- a/absl/random/internal/gaussian_distribution_gentables.cc
+++ b/absl/random/internal/gaussian_distribution_gentables.cc
@@ -27,6 +27,7 @@
 #include "absl/base/macros.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 namespace {
 
@@ -135,6 +136,7 @@ void TableGenerator::Print(std::ostream* os) {
 }
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 int main(int, char**) {
diff --git a/absl/random/internal/generate_real.h b/absl/random/internal/generate_real.h
index 246d863e56e4..20f6d20807d5 100644
--- a/absl/random/internal/generate_real.h
+++ b/absl/random/internal/generate_real.h
@@ -29,6 +29,7 @@
 #include "absl/random/internal/traits.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 
 // Tristate tag types controlling the output of GenerateRealFromBits.
@@ -139,6 +140,7 @@ inline RealType GenerateRealFromBits(uint64_t bits, int exp_bias = 0) {
 }
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_INTERNAL_GENERATE_REAL_H_
diff --git a/absl/random/internal/iostream_state_saver.h b/absl/random/internal/iostream_state_saver.h
index df88fa76bcde..7378829a423c 100644
--- a/absl/random/internal/iostream_state_saver.h
+++ b/absl/random/internal/iostream_state_saver.h
@@ -24,6 +24,7 @@
 #include "absl/numeric/int128.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 
 // The null_state_saver does nothing.
@@ -238,6 +239,7 @@ inline FloatType read_floating_point(IStream& is) {
 }
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_INTERNAL_IOSTREAM_STATE_SAVER_H_
diff --git a/absl/random/internal/mock_overload_set.h b/absl/random/internal/mock_overload_set.h
index 539313d73c95..c2a30d89d52b 100644
--- a/absl/random/internal/mock_overload_set.h
+++ b/absl/random/internal/mock_overload_set.h
@@ -23,6 +23,7 @@
 #include "absl/random/mocking_bit_gen.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 
 template <typename DistrT, typename Fn>
@@ -85,5 +86,6 @@ struct MockOverloadSet<DistrT, FirstSig, Rest...>
 };
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
 #endif  // ABSL_RANDOM_INTERNAL_MOCK_OVERLOAD_SET_H_
diff --git a/absl/random/internal/mocking_bit_gen_base.h b/absl/random/internal/mocking_bit_gen_base.h
index aff2ba6df3e7..eeeae9d295b2 100644
--- a/absl/random/internal/mocking_bit_gen_base.h
+++ b/absl/random/internal/mocking_bit_gen_base.h
@@ -25,6 +25,7 @@
 #include "absl/strings/str_cat.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 
 // MockingBitGenExpectationFormatter is invoked to format unsatisfied mocks
@@ -113,6 +114,7 @@ class MockingBitGenBase {
 };  // namespace random_internal
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_INTERNAL_MOCKING_BIT_GEN_BASE_H_
diff --git a/absl/random/internal/nanobenchmark.cc b/absl/random/internal/nanobenchmark.cc
index feb81c859585..8fee77fcc776 100644
--- a/absl/random/internal/nanobenchmark.cc
+++ b/absl/random/internal/nanobenchmark.cc
@@ -70,6 +70,7 @@
 #endif
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal_nanobenchmark {
 namespace {
 
@@ -799,4 +800,5 @@ size_t Measure(const Func func, const void* arg, const FuncInput* inputs,
 }
 
 }  // namespace random_internal_nanobenchmark
+ABSL_NAMESPACE_END
 }  // namespace absl
diff --git a/absl/random/internal/nanobenchmark.h b/absl/random/internal/nanobenchmark.h
index c2b650d191b7..a5097ba27b0f 100644
--- a/absl/random/internal/nanobenchmark.h
+++ b/absl/random/internal/nanobenchmark.h
@@ -50,7 +50,10 @@
 #include <stddef.h>
 #include <stdint.h>
 
+#include "absl/base/config.h"
+
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal_nanobenchmark {
 
 // Input influencing the function being measured (e.g. number of bytes to copy).
@@ -163,6 +166,7 @@ static inline size_t MeasureClosure(const Closure& closure,
 }
 
 }  // namespace random_internal_nanobenchmark
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_INTERNAL_NANOBENCHMARK_H_
diff --git a/absl/random/internal/nanobenchmark_test.cc b/absl/random/internal/nanobenchmark_test.cc
index 383345a8b474..ab824ef55fd9 100644
--- a/absl/random/internal/nanobenchmark_test.cc
+++ b/absl/random/internal/nanobenchmark_test.cc
@@ -18,6 +18,7 @@
 #include "absl/strings/numbers.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal_nanobenchmark {
 namespace {
 
@@ -67,6 +68,7 @@ void RunAll(const int argc, char* argv[]) {
 
 }  // namespace
 }  // namespace random_internal_nanobenchmark
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 int main(int argc, char* argv[]) {
diff --git a/absl/random/internal/nonsecure_base.h b/absl/random/internal/nonsecure_base.h
index 8847e74bef6b..730fa2ea12d2 100644
--- a/absl/random/internal/nonsecure_base.h
+++ b/absl/random/internal/nonsecure_base.h
@@ -33,6 +33,7 @@
 #include "absl/types/span.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 
 // Each instance of NonsecureURBGBase<URBG> will be seeded by variates produced
@@ -143,6 +144,7 @@ class NonsecureURBGBase {
 };
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_INTERNAL_NONSECURE_BASE_H_
diff --git a/absl/random/internal/pcg_engine.h b/absl/random/internal/pcg_engine.h
index b5df4eafffa4..53c23fe1b492 100644
--- a/absl/random/internal/pcg_engine.h
+++ b/absl/random/internal/pcg_engine.h
@@ -24,6 +24,7 @@
 #include "absl/random/internal/iostream_state_saver.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 
 // pcg_engine is a simplified implementation of Melissa O'Neil's PCG engine in
@@ -300,6 +301,7 @@ using pcg32_2018_engine = pcg_engine<
     random_internal::pcg_xsh_rr_64_32>;
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_INTERNAL_PCG_ENGINE_H_
diff --git a/absl/random/internal/pool_urbg.cc b/absl/random/internal/pool_urbg.cc
index f2e1c1f6fe26..5bee530770eb 100644
--- a/absl/random/internal/pool_urbg.cc
+++ b/absl/random/internal/pool_urbg.cc
@@ -37,6 +37,7 @@ using absl::base_internal::SpinLock;
 using absl::base_internal::SpinLockHolder;
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 namespace {
 
@@ -249,4 +250,5 @@ template class RandenPool<uint32_t>;
 template class RandenPool<uint64_t>;
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
diff --git a/absl/random/internal/pool_urbg.h b/absl/random/internal/pool_urbg.h
index 9b2dd4bfceeb..05721929f54e 100644
--- a/absl/random/internal/pool_urbg.h
+++ b/absl/random/internal/pool_urbg.h
@@ -22,6 +22,7 @@
 #include "absl/types/span.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 
 // RandenPool is a thread-safe random number generator [random.req.urbg] that
@@ -124,6 +125,7 @@ class PoolURBG {
 };
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_INTERNAL_POOL_URBG_H_
diff --git a/absl/random/internal/randen.cc b/absl/random/internal/randen.cc
index bab8075a54f8..78a1e00c0832 100644
--- a/absl/random/internal/randen.cc
+++ b/absl/random/internal/randen.cc
@@ -41,6 +41,7 @@
 // structured/low-entropy counters to digits of Pi.
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 namespace {
 
@@ -86,4 +87,5 @@ Randen::Randen() {
 }
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
diff --git a/absl/random/internal/randen.h b/absl/random/internal/randen.h
index a4ff25459688..c2834aaf3d2c 100644
--- a/absl/random/internal/randen.h
+++ b/absl/random/internal/randen.h
@@ -23,6 +23,7 @@
 #include "absl/random/internal/randen_traits.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 
 // RANDen = RANDom generator or beetroots in Swiss German.
@@ -95,6 +96,7 @@ class Randen {
 };
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_INTERNAL_RANDEN_H_
diff --git a/absl/random/internal/randen_detect.cc b/absl/random/internal/randen_detect.cc
index d5946b219cc2..d63230c25583 100644
--- a/absl/random/internal/randen_detect.cc
+++ b/absl/random/internal/randen_detect.cc
@@ -95,6 +95,7 @@ static uint32_t GetAuxval(uint32_t hwcap_type) {
 #endif
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 
 // The default return at the end of the function might be unreachable depending
@@ -216,4 +217,5 @@ bool CPUSupportsRandenHwAes() {
 #endif
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
diff --git a/absl/random/internal/randen_detect.h b/absl/random/internal/randen_detect.h
index 44c5c6672391..f283f4322647 100644
--- a/absl/random/internal/randen_detect.h
+++ b/absl/random/internal/randen_detect.h
@@ -15,7 +15,10 @@
 #ifndef ABSL_RANDOM_INTERNAL_RANDEN_DETECT_H_
 #define ABSL_RANDOM_INTERNAL_RANDEN_DETECT_H_
 
+#include "absl/base/config.h"
+
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 
 // Returns whether the current CPU supports RandenHwAes implementation.
@@ -24,6 +27,7 @@ namespace random_internal {
 bool CPUSupportsRandenHwAes();
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_INTERNAL_RANDEN_DETECT_H_
diff --git a/absl/random/internal/randen_engine.h b/absl/random/internal/randen_engine.h
index 02212a137c36..6b33731336e7 100644
--- a/absl/random/internal/randen_engine.h
+++ b/absl/random/internal/randen_engine.h
@@ -28,6 +28,7 @@
 #include "absl/random/internal/randen.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 
 // Deterministic pseudorandom byte generator with backtracking resistance
@@ -223,6 +224,7 @@ class alignas(16) randen_engine {
 };
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_INTERNAL_RANDEN_ENGINE_H_
diff --git a/absl/random/internal/randen_hwaes.cc b/absl/random/internal/randen_hwaes.cc
index 6cc36fd39b5e..e23844f12e56 100644
--- a/absl/random/internal/randen_hwaes.cc
+++ b/absl/random/internal/randen_hwaes.cc
@@ -75,6 +75,7 @@
 #include <cstdlib>
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 
 // No accelerated implementation.
@@ -106,6 +107,7 @@ void RandenHwAes::Generate(const void*, void*) {
 }
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #else  // defined(ABSL_RANDEN_HWAES_IMPL)
@@ -518,6 +520,7 @@ inline ABSL_TARGET_CRYPTO void Permute(
 }  // namespace
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 
 bool HasRandenHwAesImplementation() { return true; }
@@ -629,6 +632,7 @@ void ABSL_TARGET_CRYPTO RandenHwAes::Generate(const void* keys,
 #endif
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // (ABSL_RANDEN_HWAES_IMPL)
diff --git a/absl/random/internal/randen_hwaes.h b/absl/random/internal/randen_hwaes.h
index d8e6055f01a9..bce36b522609 100644
--- a/absl/random/internal/randen_hwaes.h
+++ b/absl/random/internal/randen_hwaes.h
@@ -15,12 +15,15 @@
 #ifndef ABSL_RANDOM_INTERNAL_RANDEN_HWAES_H_
 #define ABSL_RANDOM_INTERNAL_RANDEN_HWAES_H_
 
+#include "absl/base/config.h"
+
 // HERMETIC NOTE: The randen_hwaes target must not introduce duplicate
 // symbols from arbitrary system and other headers, since it may be built
 // with different flags from other targets, using different levels of
 // optimization, potentially introducing ODR violations.
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 
 // RANDen = RANDom generator or beetroots in Swiss German.
@@ -41,6 +44,7 @@ class RandenHwAes {
 bool HasRandenHwAesImplementation();
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_INTERNAL_RANDEN_HWAES_H_
diff --git a/absl/random/internal/randen_slow.cc b/absl/random/internal/randen_slow.cc
index e7959c7e0525..8d07458254a5 100644
--- a/absl/random/internal/randen_slow.cc
+++ b/absl/random/internal/randen_slow.cc
@@ -462,6 +462,7 @@ inline ABSL_RANDOM_INTERNAL_ATTRIBUTE_ALWAYS_INLINE void Permute(
 }  // namespace
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 
 const void* RandenSlow::GetKeys() {
@@ -501,4 +502,5 @@ void RandenSlow::Generate(const void* keys, void* state_void) {
 }
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
diff --git a/absl/random/internal/randen_slow.h b/absl/random/internal/randen_slow.h
index 305861308003..72f92b54ad23 100644
--- a/absl/random/internal/randen_slow.h
+++ b/absl/random/internal/randen_slow.h
@@ -17,7 +17,10 @@
 
 #include <cstddef>
 
+#include "absl/base/config.h"
+
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 
 // RANDen = RANDom generator or beetroots in Swiss German.
@@ -38,6 +41,7 @@ class RandenSlow {
 };
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_INTERNAL_RANDEN_SLOW_H_
diff --git a/absl/random/internal/randen_traits.h b/absl/random/internal/randen_traits.h
index 4f1f408d1917..2b8bbe73830e 100644
--- a/absl/random/internal/randen_traits.h
+++ b/absl/random/internal/randen_traits.h
@@ -22,7 +22,10 @@
 
 #include <cstddef>
 
+#include "absl/base/config.h"
+
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 
 // RANDen = RANDom generator or beetroots in Swiss German.
@@ -54,6 +57,7 @@ struct RandenTraits {
 };
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_INTERNAL_RANDEN_TRAITS_H_
diff --git a/absl/random/internal/salted_seed_seq.h b/absl/random/internal/salted_seed_seq.h
index 864870069254..5953a090f80c 100644
--- a/absl/random/internal/salted_seed_seq.h
+++ b/absl/random/internal/salted_seed_seq.h
@@ -30,6 +30,7 @@
 #include "absl/types/span.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 
 // This class conforms to the C++ Standard "Seed Sequence" concept
@@ -160,6 +161,7 @@ SaltedSeedSeq<typename std::decay<SSeq>::type> MakeSaltedSeedSeq(SSeq&& seq) {
 }
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_INTERNAL_SALTED_SEED_SEQ_H_
diff --git a/absl/random/internal/seed_material.cc b/absl/random/internal/seed_material.cc
index ab4dd0c26b07..4d38a57419ec 100644
--- a/absl/random/internal/seed_material.cc
+++ b/absl/random/internal/seed_material.cc
@@ -61,6 +61,7 @@
 #endif
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 namespace {
 
@@ -214,4 +215,5 @@ absl::optional<uint32_t> GetSaltMaterial() {
 }
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
diff --git a/absl/random/internal/seed_material.h b/absl/random/internal/seed_material.h
index 57de8a24d5e0..4be10e925685 100644
--- a/absl/random/internal/seed_material.h
+++ b/absl/random/internal/seed_material.h
@@ -27,6 +27,7 @@
 #include "absl/types/span.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 
 // Returns the number of 32-bit blocks needed to contain the given number of
@@ -97,6 +98,7 @@ void MixIntoSeedMaterial(absl::Span<const uint32_t> sequence,
 absl::optional<uint32_t> GetSaltMaterial();
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_INTERNAL_SEED_MATERIAL_H_
diff --git a/absl/random/internal/sequence_urbg.h b/absl/random/internal/sequence_urbg.h
index 9a9b57738da4..bc96a12cd29c 100644
--- a/absl/random/internal/sequence_urbg.h
+++ b/absl/random/internal/sequence_urbg.h
@@ -21,7 +21,10 @@
 #include <type_traits>
 #include <vector>
 
+#include "absl/base/config.h"
+
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 
 // `sequence_urbg` is a simple random number generator which meets the
@@ -51,6 +54,7 @@ class sequence_urbg {
 };
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_INTERNAL_SEQUENCE_URBG_H_
diff --git a/absl/random/internal/traits.h b/absl/random/internal/traits.h
index 40eb011f195f..75772bd9abb4 100644
--- a/absl/random/internal/traits.h
+++ b/absl/random/internal/traits.h
@@ -22,6 +22,7 @@
 #include "absl/base/config.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 
 // random_internal::is_widening_convertible<A, B>
@@ -94,6 +95,7 @@ struct make_unsigned_bits {
 };
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_INTERNAL_TRAITS_H_
diff --git a/absl/random/internal/uniform_helper.h b/absl/random/internal/uniform_helper.h
index f68b1823ef00..663107cb3a63 100644
--- a/absl/random/internal/uniform_helper.h
+++ b/absl/random/internal/uniform_helper.h
@@ -22,6 +22,7 @@
 #include "absl/meta/type_traits.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 template <typename IntType>
 class uniform_int_distribution;
 
@@ -173,6 +174,7 @@ struct UniformDistributionWrapper : public UniformDistribution<NumType> {
 };
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_INTERNAL_UNIFORM_HELPER_H_
diff --git a/absl/random/internal/wide_multiply.h b/absl/random/internal/wide_multiply.h
index ebbfa1f2c10e..6e4cf1be0af4 100644
--- a/absl/random/internal/wide_multiply.h
+++ b/absl/random/internal/wide_multiply.h
@@ -31,6 +31,7 @@
 #include "absl/random/internal/traits.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 namespace random_internal {
 
 // Helper object to multiply two 64-bit values to a 128-bit value.
@@ -104,6 +105,7 @@ struct wide_multiply<uint64_t> {
 #endif
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_INTERNAL_WIDE_MULTIPLY_H_
diff --git a/absl/random/log_uniform_int_distribution.h b/absl/random/log_uniform_int_distribution.h
index de58bdbe14ca..960816e2f8ff 100644
--- a/absl/random/log_uniform_int_distribution.h
+++ b/absl/random/log_uniform_int_distribution.h
@@ -30,6 +30,7 @@
 #include "absl/random/uniform_int_distribution.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 
 // log_uniform_int_distribution:
 //
@@ -247,6 +248,7 @@ std::basic_istream<CharT, Traits>& operator>>(
   return is;
 }
 
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_LOG_UNIFORM_INT_DISTRIBUTION_H_
diff --git a/absl/random/mock_distributions.h b/absl/random/mock_distributions.h
index 1af98a24a7f0..d36d5ba03cab 100644
--- a/absl/random/mock_distributions.h
+++ b/absl/random/mock_distributions.h
@@ -53,6 +53,7 @@
 #include "absl/random/mocking_bit_gen.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 
 // -----------------------------------------------------------------------------
 // absl::MockUniform
@@ -254,6 +255,7 @@ using MockZipf =
                                      IntType(MockingBitGen&, IntType, double,
                                              double)>;
 
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_MOCK_DISTRIBUTIONS_H_
diff --git a/absl/random/mocking_bit_gen.cc b/absl/random/mocking_bit_gen.cc
index 73144528a78e..6bb1e414aeab 100644
--- a/absl/random/mocking_bit_gen.cc
+++ b/absl/random/mocking_bit_gen.cc
@@ -18,6 +18,7 @@
 #include <string>
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 MockingBitGen::~MockingBitGen() {
 
   for (const auto& del : deleters_) {
@@ -25,4 +26,5 @@ MockingBitGen::~MockingBitGen() {
   }
 }
 
+ABSL_NAMESPACE_END
 }  // namespace absl
diff --git a/absl/random/mocking_bit_gen.h b/absl/random/mocking_bit_gen.h
index d1b524a993dc..36cef91113e3 100644
--- a/absl/random/mocking_bit_gen.h
+++ b/absl/random/mocking_bit_gen.h
@@ -51,6 +51,7 @@
 #include "absl/utility/utility.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 
 namespace random_internal {
 
@@ -189,6 +190,7 @@ struct DistributionCaller<absl::MockingBitGen> {
 };
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_MOCKING_BIT_GEN_H_
diff --git a/absl/random/poisson_distribution.h b/absl/random/poisson_distribution.h
index 23a953ff253c..cb5f5d5d0ff7 100644
--- a/absl/random/poisson_distribution.h
+++ b/absl/random/poisson_distribution.h
@@ -28,6 +28,7 @@
 #include "absl/random/internal/iostream_state_saver.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 
 // absl::poisson_distribution:
 // Generates discrete variates conforming to a Poisson distribution.
@@ -251,6 +252,7 @@ std::basic_istream<CharT, Traits>& operator>>(
   return is;
 }
 
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_POISSON_DISTRIBUTION_H_
diff --git a/absl/random/random.h b/absl/random/random.h
index dc6852f4adf3..c8f326e64252 100644
--- a/absl/random/random.h
+++ b/absl/random/random.h
@@ -41,6 +41,7 @@
 #include "absl/random/seed_sequences.h"  // IWYU pragma: export
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 
 // -----------------------------------------------------------------------------
 // absl::BitGen
@@ -182,6 +183,7 @@ using InsecureBitGen =
 // discards the intermediate results.
 // ---------------------------------------------------------------------------
 
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_RANDOM_H_
diff --git a/absl/random/seed_gen_exception.cc b/absl/random/seed_gen_exception.cc
index e4271baaa07f..fdcb54a86cdd 100644
--- a/absl/random/seed_gen_exception.cc
+++ b/absl/random/seed_gen_exception.cc
@@ -19,6 +19,7 @@
 #include "absl/base/config.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 
 static constexpr const char kExceptionMessage[] =
     "Failed generating seed-material for URBG.";
@@ -41,4 +42,5 @@ void ThrowSeedGenException() {
 }
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
diff --git a/absl/random/seed_gen_exception.h b/absl/random/seed_gen_exception.h
index b464d52fb954..535390056437 100644
--- a/absl/random/seed_gen_exception.h
+++ b/absl/random/seed_gen_exception.h
@@ -28,7 +28,10 @@
 
 #include <exception>
 
+#include "absl/base/config.h"
+
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 
 //------------------------------------------------------------------------------
 // SeedGenException
@@ -46,6 +49,7 @@ namespace random_internal {
 [[noreturn]] void ThrowSeedGenException();
 
 }  // namespace random_internal
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_SEED_GEN_EXCEPTION_H_
diff --git a/absl/random/seed_sequences.cc b/absl/random/seed_sequences.cc
index 9f319615289a..426eafd3c8de 100644
--- a/absl/random/seed_sequences.cc
+++ b/absl/random/seed_sequences.cc
@@ -17,6 +17,7 @@
 #include "absl/random/internal/pool_urbg.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 
 SeedSeq MakeSeedSeq() {
   SeedSeq::result_type seed_material[8];
@@ -24,4 +25,5 @@ SeedSeq MakeSeedSeq() {
   return SeedSeq(std::begin(seed_material), std::end(seed_material));
 }
 
+ABSL_NAMESPACE_END
 }  // namespace absl
diff --git a/absl/random/seed_sequences.h b/absl/random/seed_sequences.h
index 631d1ecd4ea9..ff1340cc8eed 100644
--- a/absl/random/seed_sequences.h
+++ b/absl/random/seed_sequences.h
@@ -34,6 +34,7 @@
 #include "absl/types/span.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 
 // -----------------------------------------------------------------------------
 // absl::SeedSeq
@@ -103,6 +104,7 @@ SeedSeq CreateSeedSeqFrom(URBG* urbg) {
 //
 SeedSeq MakeSeedSeq();
 
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_SEED_SEQUENCES_H_
diff --git a/absl/random/uniform_int_distribution.h b/absl/random/uniform_int_distribution.h
index dc8ba8c1e2a2..da66564a6b3c 100644
--- a/absl/random/uniform_int_distribution.h
+++ b/absl/random/uniform_int_distribution.h
@@ -40,6 +40,7 @@
 #include "absl/random/internal/wide_multiply.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 
 // absl::uniform_int_distribution<T>
 //
@@ -268,6 +269,7 @@ uniform_int_distribution<IntType>::Generate(
   return helper::hi(product);
 }
 
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_UNIFORM_INT_DISTRIBUTION_H_
diff --git a/absl/random/uniform_real_distribution.h b/absl/random/uniform_real_distribution.h
index bf2ed2c5ad36..5ba17b2341cf 100644
--- a/absl/random/uniform_real_distribution.h
+++ b/absl/random/uniform_real_distribution.h
@@ -45,6 +45,7 @@
 #include "absl/random/internal/iostream_state_saver.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 
 // absl::uniform_real_distribution<T>
 //
@@ -195,6 +196,7 @@ std::basic_istream<CharT, Traits>& operator>>(
   }
   return is;
 }
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_UNIFORM_REAL_DISTRIBUTION_H_
diff --git a/absl/random/zipf_distribution.h b/absl/random/zipf_distribution.h
index d7b4ac38edac..22ebc756cfef 100644
--- a/absl/random/zipf_distribution.h
+++ b/absl/random/zipf_distribution.h
@@ -26,6 +26,7 @@
 #include "absl/random/uniform_real_distribution.h"
 
 namespace absl {
+ABSL_NAMESPACE_BEGIN
 
 // absl::zipf_distribution produces random integer-values in the range [0, k],
 // distributed according to the discrete probability function:
@@ -264,6 +265,7 @@ std::basic_istream<CharT, Traits>& operator>>(
   return is;
 }
 
+ABSL_NAMESPACE_END
 }  // namespace absl
 
 #endif  // ABSL_RANDOM_ZIPF_DISTRIBUTION_H_