basegfx/test/B2DPolyPolygonTest.cxx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
New commits: commit 5a9425af92bef565f162d362c94433cc0d053789 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Feb 23 08:45:13 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Feb 23 11:17:34 2023 +0000 make B2DPolyPolygonTest deterministic Change-Id: Ia8071285d70b39b21b1312d461dc8d502d5cb305 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147497 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/basegfx/test/B2DPolyPolygonTest.cxx b/basegfx/test/B2DPolyPolygonTest.cxx index 1fef45328357..f51d396b8578 100644 --- a/basegfx/test/B2DPolyPolygonTest.cxx +++ b/basegfx/test/B2DPolyPolygonTest.cxx @@ -25,11 +25,10 @@ #include <basegfx/polygon/b2dtrapezoid.hxx> #include "boxclipper.hxx" +#include <random> namespace basegfx { -using ::basegfx2d::getRandomOrdinal; - class b2dpolypolygon : public CppUnit::TestFixture { public: @@ -65,6 +64,15 @@ public: CPPUNIT_ASSERT_MESSAGE("more than zero sub-divided trapezoids", !aVector.empty()); } + std::mt19937 rng; // Standard mersenne_twister_engine + + /// Gets a random ordinal [0,n) + ::std::size_t getRandomOrdinal(const ::std::size_t n) + { + std::uniform_int_distribution<size_t> dist(0, n - 1); + return dist(rng); + } + // Change the following lines only, if you add, remove or rename // member functions of the current class, // because these macros are need by auto register mechanism.