diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-05-16 10:16:01 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-05-17 08:22:14 +0200 |
commit | 7ab34b51f2d45137191145d31b4b0c7d18f577bf (patch) | |
tree | abb760e86740a0e073008047d966af250e8c8c5d /sal/rtl | |
parent | f8e3ad02737854686a590f7f8f02eb72e03a0f8e (diff) |
loplugin:redundantcast improvements for floating-integer conversions
Change-Id: I63dbf18f144a792ae775fe6706da81657f790016
Reviewed-on: https://gerrit.libreoffice.org/54416
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sal/rtl')
-rw-r--r-- | sal/rtl/random.cxx | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sal/rtl/random.cxx b/sal/rtl/random.cxx index 158e8fff3cc5..c9269abb837b 100644 --- a/sal/rtl/random.cxx +++ b/sal/rtl/random.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <cmath> + #include <sal/types.h> #include <osl/thread.h> #include <osl/thread.hxx> @@ -81,8 +85,7 @@ static double data(RandomData_Impl *pImpl) (static_cast<double>(pImpl->m_nY) / 30269.0) + (static_cast<double>(pImpl->m_nZ) / 30307.0) ); - random -= static_cast<double>(static_cast<sal_uInt32>(random)); - return random; + return std::modf(random, &random); } static bool initPool(RandomPool_Impl *pImpl) |