summaryrefslogtreecommitdiff
path: root/absl/random/log_uniform_int_distribution.h
diff options
context:
space:
mode:
Diffstat (limited to 'absl/random/log_uniform_int_distribution.h')
-rw-r--r--absl/random/log_uniform_int_distribution.h20
1 files changed, 11 insertions, 9 deletions
diff --git a/absl/random/log_uniform_int_distribution.h b/absl/random/log_uniform_int_distribution.h
index a12fa4cb..960816e2 100644
--- a/absl/random/log_uniform_int_distribution.h
+++ b/absl/random/log_uniform_int_distribution.h
@@ -23,14 +23,14 @@
#include <ostream>
#include <type_traits>
-#include "absl/random/internal/distribution_impl.h"
#include "absl/random/internal/fastmath.h"
+#include "absl/random/internal/generate_real.h"
#include "absl/random/internal/iostream_state_saver.h"
#include "absl/random/internal/traits.h"
#include "absl/random/uniform_int_distribution.h"
namespace absl {
-inline namespace lts_2019_08_08 {
+ABSL_NAMESPACE_BEGIN
// log_uniform_int_distribution:
//
@@ -193,13 +193,15 @@ log_uniform_int_distribution<IntType>::Generate(
const double r = std::pow(p.base(), d);
const double s = (r * p.base()) - 1.0;
- base_e = (r > (std::numeric_limits<unsigned_type>::max)())
- ? (std::numeric_limits<unsigned_type>::max)()
- : static_cast<unsigned_type>(r);
+ base_e =
+ (r > static_cast<double>((std::numeric_limits<unsigned_type>::max)()))
+ ? (std::numeric_limits<unsigned_type>::max)()
+ : static_cast<unsigned_type>(r);
- top_e = (s > (std::numeric_limits<unsigned_type>::max)())
- ? (std::numeric_limits<unsigned_type>::max)()
- : static_cast<unsigned_type>(s);
+ top_e =
+ (s > static_cast<double>((std::numeric_limits<unsigned_type>::max)()))
+ ? (std::numeric_limits<unsigned_type>::max)()
+ : static_cast<unsigned_type>(s);
}
const unsigned_type lo = (base_e >= p.range()) ? p.range() : base_e;
@@ -246,7 +248,7 @@ std::basic_istream<CharT, Traits>& operator>>(
return is;
}
-} // inline namespace lts_2019_08_08
+ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_RANDOM_LOG_UNIFORM_INT_DISTRIBUTION_H_