Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "rng.h"
00018
00019 #include <../config.h>
00020 #ifdef __RNGWRAPPER_BOOST__ // BOOST RANDOM LIBRARY
00021
00022
00023 #include <boost/random/mersenne_twister.hpp>
00024 #include <boost/random/variate_generator.hpp>
00025 #include <boost/random/normal_distribution.hpp>
00026 #include <boost/random/uniform_01.hpp>
00027 #include <boost/random/uniform_real.hpp>
00028
00029 static boost::mt19937 Boost_Rng;
00030
00031 static boost::uniform_real<double> Uniform_Distribution;
00032 static boost::variate_generator<boost::mt19937&,boost::uniform_real<double> > roll(Boost_Rng,Uniform_Distribution);
00033
00034 double BFL::rnorm(const double& mu,const double& sigma)
00035 {
00036 boost::normal_distribution<double> TestDist(mu,sigma);
00037 boost::variate_generator <boost::mt19937 &,boost::normal_distribution<double> > TestGen(Boost_Rng,TestDist);
00038 return TestGen();
00039 }
00040
00041 double BFL::runif()
00042 {
00043 return roll();
00044 }
00045
00046 double BFL::runif(const double &min, const double& max)
00047 {
00048 boost::uniform_real<double> Uniform_DistributionMinMax(min,max);
00049 boost::variate_generator<boost::mt19937&,boost::uniform_real<double> > roll(Boost_Rng,Uniform_DistributionMinMax);
00050 return roll();
00051 }
00052
00053 #endif // __RNGWRAPPER_BOOST__
00054
00055
00056
00057
00058
00059 #ifdef __RNGWRAPPER_SCYTHE__ // SCYTHE RANDOM LIBRARY
00060
00061 #include <scythestat/rng.h>
00062 #include <scythestat/rng/mersenne.h>
00063 #include <scythestat/distributions.h>
00064
00065
00066 static scythe::mersenne bfl_mersenne;
00067
00068
00069 double BFL::rnorm(const double & mu, const double & sigma)
00070 {
00071 return (bfl_mersenne.rnorm(mu,sigma));
00072 }
00073
00074
00075 double BFL::runif()
00076 {
00077 return (bfl_mersenne.runif());
00078 }
00079
00080 double BFL::runif(const double &min, const double& max)
00081 {
00082 return (bfl_mersenne.runif()*(max-min)+min);
00083 }
00084 #endif // __RNGWRAPPER_SCYTHE__
00085
00086
00087
00088
00089
00090 #ifdef __RNGWRAPPER_LTI__ // LTILIB
00091
00092 #include <ltilib/ltiUniformDist.h>
00093 #include <ltilib/ltiGaussDist.h>
00094
00095
00096 double BFL::rnorm(const double & mu, const double & sigma)
00097 {
00098 lti::gaussianDistribution g(mu,sigma);
00099 return g.draw();
00100 }
00101
00102
00103
00104 static lti::uniformDistribution unif;
00105
00106
00107 double BFL::runif()
00108 {
00109 return unif.draw();
00110 }
00111
00112
00113 double BFL::runif(const double &min, const double& max)
00114 {
00115 lti::uniformDistribution u(min,max);
00116 return u.draw();
00117 }
00118 #endif // __RNGWRAPPER_LTI__
00119
bfl
Author(s): Klaas Gadeyne, Wim Meeussen, Tinne Delaet and many others. See web page for a full contributor list. ROS package maintained by Wim Meeussen.
autogenerated on Fri Aug 28 2015 10:10:21