[Libreoffice-commits] core.git: 2 commits - canvas/workben cui/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Jul 16 18:31:52 UTC 2019


 canvas/workben/canvasdemo.cxx         |    5 +++--
 cui/source/dialogs/tipofthedaydlg.cxx |    4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 0b4816c33fef67bace8c223034f4340d1c80b441
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jul 16 11:40:43 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Jul 16 20:31:11 2019 +0200

    cid#1448384 Calling risky rand
    
    Change-Id: I4787c004ca73cb3496a33c06c03ea4cd988b72ad
    Reviewed-on: https://gerrit.libreoffice.org/75712
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/canvas/workben/canvasdemo.cxx b/canvas/workben/canvasdemo.cxx
index 9f21829bca5f..23df7d4c437c 100644
--- a/canvas/workben/canvasdemo.cxx
+++ b/canvas/workben/canvasdemo.cxx
@@ -37,6 +37,7 @@
 #include <com/sun/star/rendering/XSpriteCanvas.hpp>
 #include <com/sun/star/ucb/UniversalContentBroker.hpp>
 #include <comphelper/processfactory.hxx>
+#include <comphelper/random.hxx>
 #include <cppuhelper/bootstrap.hxx>
 #include <vcl/canvastools.hxx>
 #include <vcl/svapp.hxx>
@@ -424,9 +425,9 @@ class DemoRenderer
             maRenderState = maOldRenderState; // pop
         }
 
-    double gimmerand()
+        double gimmerand()
         {
-            return static_cast<double>(rand()) / RAND_MAX * 100 + 50;
+            return comphelper::rng::uniform_real_distribution(0, 100);
         }
 
         void drawArcs()
commit 8536d63dc3a65bdf0121a000210a4f92379ce2a0
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jul 16 11:34:05 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Jul 16 20:30:58 2019 +0200

    cid#1448481 Calling risky rand
    
    Change-Id: I07c9956d034a1b78c77608da57dea299572fea85
    Reviewed-on: https://gerrit.libreoffice.org/75711
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cui/source/dialogs/tipofthedaydlg.cxx b/cui/source/dialogs/tipofthedaydlg.cxx
index 894768f5de99..1495d83f163b 100644
--- a/cui/source/dialogs/tipofthedaydlg.cxx
+++ b/cui/source/dialogs/tipofthedaydlg.cxx
@@ -29,6 +29,7 @@
 #include <vcl/virdev.hxx>
 #include <sfx2/sfxhelp.hxx>
 #include <vcl/svapp.hxx>
+#include <comphelper/random.hxx>
 
 TipOfTheDayDialog::TipOfTheDayDialog(weld::Window* pParent)
     : GenericDialogController(pParent, "cui/ui/tipofthedaydialog.ui", "TipOfTheDayDialog")
@@ -42,8 +43,7 @@ TipOfTheDayDialog::TipOfTheDayDialog(weld::Window* pParent)
     m_pNext->connect_clicked(LINK(this, TipOfTheDayDialog, OnNextClick));
 
     nNumberOfTips = SAL_N_ELEMENTS(TIPOFTHEDAY_STRINGARRAY);
-    srand(time(nullptr));
-    nCurrentTip = rand() % nNumberOfTips;
+    nCurrentTip = comphelper::rng::uniform_int_distribution(0, nNumberOfTips - 1);
     UpdateTip();
 }
 


More information about the Libreoffice-commits mailing list