diff options
Diffstat (limited to 'slideshow')
-rw-r--r-- | slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx | 4 | ||||
-rw-r--r-- | slideshow/source/inc/tools.hxx | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx index 86d11bf58c9b..ce78ab0c40ec 100644 --- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx +++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx @@ -32,6 +32,8 @@ #include <utility> #include <boost/make_shared.hpp> +#include <boost/math/special_functions/next.hpp> +#include <comphelper/random.hxx> #include "OGLTrans_TransitionImpl.hxx" #include <math.h> @@ -674,7 +676,7 @@ boost::shared_ptr<OGLTransitionImpl> makeRochade() inline double randFromNeg1to1() { - return ( ( static_cast<double>( rand() ) / static_cast<double>( RAND_MAX ) ) * 2.0 ) - 1.0; + return comphelper::rng::uniform_real_distribution(-1.0, boost::math::nextafter(1.0, DBL_MAX)); } // TODO(Q3): extract to basegfx diff --git a/slideshow/source/inc/tools.hxx b/slideshow/source/inc/tools.hxx index 4e8037e3f3d3..682530f3bbc0 100644 --- a/slideshow/source/inc/tools.hxx +++ b/slideshow/source/inc/tools.hxx @@ -26,7 +26,7 @@ #include <com/sun/star/animations/XAnimationNode.hpp> #include <com/sun/star/container/XEnumerationAccess.hpp> #include <com/sun/star/container/XEnumeration.hpp> - +#include <comphelper/random.hxx> #include <vector> #include <cppcanvas/color.hxx> @@ -293,8 +293,7 @@ namespace slideshow /// Gets a random ordinal [0,n) inline ::std::size_t getRandomOrdinal( const ::std::size_t n ) { - return static_cast< ::std::size_t >( - double(n) * rand() / (RAND_MAX + 1.0) ); + return comphelper::rng::uniform_int_distribution(static_cast<size_t>(0), n-1); } /// To work around ternary operator in initializer lists |