LCOV - code coverage report
Current view: top level - maze - Random_MT.cpp (source / functions) Hit Total Coverage
Test: plumed test coverage Lines: 20 20 100.0 %
Date: 2024-10-11 08:09:47 Functions: 6 6 100.0 %

          Line data    Source code
       1             : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
       2             : Copyright (c) 2019 Jakub Rydzewski (jr@fizyka.umk.pl). All rights reserved.
       3             : 
       4             : See http://www.maze-code.github.io for more information.
       5             : 
       6             : This file is part of maze.
       7             : 
       8             : maze is free software: you can redistribute it and/or modify it under the
       9             : terms of the GNU Lesser General Public License as published by the Free
      10             : Software Foundation, either version 3 of the License, or (at your option)
      11             : any later version.
      12             : 
      13             : maze is distributed in the hope that it will be useful, but WITHOUT ANY
      14             : WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
      15             : FOR A PARTICULAR PURPOSE.
      16             : 
      17             : See the GNU Lesser General Public License for more details.
      18             : 
      19             : You should have received a copy of the GNU Lesser General Public License
      20             : along with maze. If not, see <https://www.gnu.org/licenses/>.
      21             : +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
      22             : 
      23             : /**
      24             :  * @file Random_MT.cpp
      25             :  *
      26             :  * @author J. Rydzewski (jr@fizyka.umk.pl)
      27             :  *
      28             :  * @brief Dummy cpp file.
      29             :  */
      30             : 
      31             : #include "Random_MT.h"
      32             : 
      33             : namespace PLMD {
      34             : namespace maze {
      35             : 
      36        1211 : std::mt19937_64& rnd::mt_eng() {
      37        1218 :   static std::mt19937_64 mt{};
      38             : 
      39        1211 :   return mt;
      40             : }
      41             : 
      42         246 : double rnd::next_double(double f, double e) {
      43         246 :   static std::uniform_real_distribution<double> dist_double(f, e);
      44             :   std::uniform_real_distribution<double>::param_type p(f, e);
      45             :   dist_double.param(p);
      46             : 
      47         246 :   return dist_double(mt_eng());
      48             : }
      49             : 
      50         536 : double rnd::next_double() {
      51         536 :   static std::uniform_real_distribution<double> dist_double(0, 1);
      52             :   std::uniform_real_distribution<double>::param_type p(0, 1);
      53             :   dist_double.param(p);
      54             : 
      55         536 :   return dist_double(mt_eng());
      56             : }
      57             : 
      58         324 : int rnd::next_int(int e) {
      59         324 :   static std::uniform_int_distribution<int> dist_int(0, e-1);
      60         324 :   std::uniform_int_distribution<int>::param_type p(0, e-1);
      61             :   dist_int.param(p);
      62             : 
      63         324 :   return dist_int(mt_eng());
      64             : }
      65             : 
      66           4 : int rnd::next_int(int f, int e) {
      67           4 :   static std::uniform_int_distribution<int> dist_int(f, e-1);
      68           4 :   std::uniform_int_distribution<int>::param_type p(f, e-1);
      69             :   dist_int.param(p);
      70             : 
      71           4 :   return dist_int(mt_eng());
      72             : }
      73             : 
      74          94 : double rnd::next_cauchy(double m, double s) {
      75          94 :   static std::cauchy_distribution<double> dist_cauchy(m, s);
      76             : 
      77          94 :   return dist_cauchy(mt_eng());
      78             : }
      79             : 
      80             : } // namespace maze
      81             : } // namespace PLMD

Generated by: LCOV version 1.15