[Libreoffice-commits] core.git: sc/source

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Sun Jan 25 22:32:51 PST 2015


 sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx |   49 ++++------
 1 file changed, 20 insertions(+), 29 deletions(-)

New commits:
commit 26ad60aec69310fecd918f1c2e09056aa4782320
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Mon Jan 26 15:29:38 2015 +0900

    convert to use std random instead of boost
    
    Change-Id: I7746b17a41a6f8807d8ef441ad44a005d04775af

diff --git a/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx b/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx
index 9e9b5c5..954cadd 100644
--- a/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx
@@ -23,16 +23,7 @@
 #include "docfunc.hxx"
 #include "StatisticsDialogs.hrc"
 
-#include <boost/random.hpp>
-#include <boost/random/uniform_real_distribution.hpp>
-#include <boost/random/uniform_int_distribution.hpp>
-#include <boost/random/binomial_distribution.hpp>
-#include <boost/random/normal_distribution.hpp>
-#include <boost/random/cauchy_distribution.hpp>
-#include <boost/random/bernoulli_distribution.hpp>
-#include <boost/random/chi_squared_distribution.hpp>
-#include <boost/random/geometric_distribution.hpp>
-#include <boost/random/negative_binomial_distribution.hpp>
+#include <random>
 
 #include "RandomNumberGeneratorDialog.hxx"
 
@@ -178,7 +169,7 @@ void ScRandomNumberGeneratorDialog::SelectGeneratorAndGenerateNumbers()
         seedValue = now.Nanosec;
     }
 
-    boost::mt19937 seed(seedValue);
+    std::mt19937 seed(seedValue);
 
     sal_Int64 parameterInteger1 = mpParameter1Value->GetValue();
     sal_Int64 parameterInteger2 = mpParameter2Value->GetValue();
@@ -196,64 +187,64 @@ void ScRandomNumberGeneratorDialog::SelectGeneratorAndGenerateNumbers()
     {
         case DIST_UNIFORM:
         {
-            boost::random::uniform_real_distribution<> distribution(parameter1, parameter2);
-            boost::variate_generator<boost::mt19937&, boost::random::uniform_real_distribution<> > rng(seed, distribution);
+            std::uniform_real_distribution<> distribution(parameter1, parameter2);
+            auto rng = std::bind(distribution, seed);
             GenerateNumbers(rng, STR_DISTRIBUTION_UNIFORM_REAL, aDecimalPlaces);
             break;
         }
         case DIST_UNIFORM_INTEGER:
         {
-            boost::random::uniform_int_distribution<> distribution(parameterInteger1, parameterInteger2);
-            boost::variate_generator<boost::mt19937&, boost::random::uniform_int_distribution<> > rng(seed, distribution);
+            std::uniform_int_distribution<> distribution(parameterInteger1, parameterInteger2);
+            auto rng = std::bind(distribution, seed);
             GenerateNumbers(rng, STR_DISTRIBUTION_UNIFORM_INTEGER, aDecimalPlaces);
             break;
         }
         case DIST_NORMAL:
         {
-            boost::random::normal_distribution<> distribution(parameter1, parameter2);
-            boost::variate_generator<boost::mt19937&, boost::random::normal_distribution<> > rng(seed, distribution);
+            std::normal_distribution<> distribution(parameter1, parameter2);
+            auto rng = std::bind(distribution, seed);
             GenerateNumbers(rng, STR_DISTRIBUTION_NORMAL, aDecimalPlaces);
             break;
         }
         case DIST_CAUCHY:
         {
-            boost::random::cauchy_distribution<> distribution(parameter1);
-            boost::variate_generator<boost::mt19937&, boost::random::cauchy_distribution<> > rng(seed, distribution);
+            std::cauchy_distribution<> distribution(parameter1);
+            auto rng = std::bind(distribution, seed);
             GenerateNumbers(rng, STR_DISTRIBUTION_CAUCHY, aDecimalPlaces);
             break;
         }
         case DIST_BERNOULLI:
         {
-            boost::random::bernoulli_distribution<> distribution(parameter1);
-            boost::variate_generator<boost::mt19937&, boost::random::bernoulli_distribution<> > rng(seed, distribution);
+            std::bernoulli_distribution distribution(parameter1);
+            auto rng = std::bind(distribution, seed);
             GenerateNumbers(rng, STR_DISTRIBUTION_BERNOULLI, aDecimalPlaces);
             break;
         }
         case DIST_BINOMIAL:
         {
-            boost::random::binomial_distribution<> distribution(parameterInteger2, parameter1);
-            boost::variate_generator<boost::mt19937&, boost::random::binomial_distribution<> > rng(seed, distribution);
+            std::binomial_distribution<> distribution(parameterInteger2, parameter1);
+            auto rng = std::bind(distribution, seed);
             GenerateNumbers(rng, STR_DISTRIBUTION_BINOMIAL, aDecimalPlaces);
             break;
         }
         case DIST_NEGATIVE_BINOMIAL:
         {
-            boost::random::negative_binomial_distribution<> distribution(parameterInteger2, parameter1);
-            boost::variate_generator<boost::mt19937&, boost::random::negative_binomial_distribution<> > rng(seed, distribution);
+            std::negative_binomial_distribution<> distribution(parameterInteger2, parameter1);
+            auto rng = std::bind(distribution, seed);
             GenerateNumbers(rng, STR_DISTRIBUTION_NEGATIVE_BINOMIAL, aDecimalPlaces);
             break;
         }
         case DIST_CHI_SQUARED:
         {
-            boost::random::chi_squared_distribution<> distribution(parameter1);
-            boost::variate_generator<boost::mt19937&, boost::random::chi_squared_distribution<> > rng(seed, distribution);
+            std::chi_squared_distribution<> distribution(parameter1);
+            auto rng = std::bind(distribution, seed);
             GenerateNumbers(rng, STR_DISTRIBUTION_CHI_SQUARED, aDecimalPlaces);
             break;
         }
         case DIST_GEOMETRIC:
         {
-            boost::random::geometric_distribution<> distribution(parameter1);
-            boost::variate_generator<boost::mt19937&, boost::random::geometric_distribution<> > rng(seed, distribution);
+            std::geometric_distribution<> distribution(parameter1);
+            auto rng = std::bind(distribution, seed);
             GenerateNumbers(rng, STR_DISTRIBUTION_GEOMETRIC, aDecimalPlaces);
             break;
         }


More information about the Libreoffice-commits mailing list