summaryrefslogtreecommitdiff
path: root/absl/random/internal/distributions.h
diff options
context:
space:
mode:
Diffstat (limited to 'absl/random/internal/distributions.h')
-rw-r--r--absl/random/internal/distributions.h36
1 files changed, 2 insertions, 34 deletions
diff --git a/absl/random/internal/distributions.h b/absl/random/internal/distributions.h
index 98d4f313..d7e3c016 100644
--- a/absl/random/internal/distributions.h
+++ b/absl/random/internal/distributions.h
@@ -23,40 +23,8 @@
#include "absl/random/internal/uniform_helper.h"
namespace absl {
-inline namespace lts_2019_08_08 {
+ABSL_NAMESPACE_BEGIN
namespace random_internal {
-template <typename D>
-struct DistributionFormatTraits;
-
-// UniformImpl implements the core logic of the Uniform<T> call, which is to
-// select the correct distribution type, compute the bounds based on the
-// interval tag, and then generate a value.
-template <typename NumType, typename TagType, typename URBG>
-NumType UniformImpl(TagType tag,
- URBG& urbg, // NOLINT(runtime/references)
- NumType lo, NumType hi) {
- static_assert(
- std::is_arithmetic<NumType>::value,
- "absl::Uniform<T>() must use an integer or real parameter type.");
-
- using distribution_t =
- typename std::conditional<std::is_integral<NumType>::value,
- absl::uniform_int_distribution<NumType>,
- absl::uniform_real_distribution<NumType>>::type;
- using format_t = random_internal::DistributionFormatTraits<distribution_t>;
-
- auto a = random_internal::uniform_lower_bound<NumType>(tag, lo, hi);
- auto b = random_internal::uniform_upper_bound<NumType>(tag, lo, hi);
- // TODO(lar): it doesn't make a lot of sense to ask for a random number in an
- // empty range. Right now we just return a boundary--even though that
- // boundary is not an acceptable value! Is there something better we can do
- // here?
-
- using gen_t = absl::decay_t<URBG>;
- if (a > b) return a;
- return DistributionCaller<gen_t>::template Call<distribution_t, format_t>(
- &urbg, a, b);
-}
// In the absence of an explicitly provided return-type, the template
// "uniform_inferred_return_t<A, B>" is used to derive a suitable type, based on
@@ -78,7 +46,7 @@ using uniform_inferred_return_t =
is_widening_convertible<A, B>::value, B, A>::type>;
} // namespace random_internal
-} // inline namespace lts_2019_08_08
+ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_INTERNAL_DISTRIBUTIONS_H_