A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Have create_jbod() return a JbodPtr instead of Jbod* to avoid memleaks
[simgrid.git]
/
include
/
xbt
/
random.hpp
diff --git
a/include/xbt/random.hpp
b/include/xbt/random.hpp
index
81572c7
..
a5c4c79
100644
(file)
--- a/
include/xbt/random.hpp
+++ b/
include/xbt/random.hpp
@@
-1,4
+1,4
@@
-/* Copyright (c) 2019-202
0
. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2019-202
3
. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
@@
-12,9
+12,7
@@
#include <random>
#include <string>
#include <random>
#include <string>
-namespace simgrid {
-namespace xbt {
-namespace random {
+namespace simgrid::xbt::random {
/** A random number generator.
*
/** A random number generator.
*
@@
-40,12
+38,12
@@
public:
/**
* @brief Read the state of the Mersenne-Twister RNG from a file
*/
/**
* @brief Read the state of the Mersenne-Twister RNG from a file
*/
- bool read_state(
std::string
filename);
+ bool read_state(
const std::string&
filename);
/**
* @brief Write the state of the Mersenne-Twister RNG to a file
*/
/**
* @brief Write the state of the Mersenne-Twister RNG to a file
*/
- bool write_state(
std::string filename)
;
+ bool write_state(
const std::string& filename) const
;
/**
* @brief Draws an integer number uniformly in range [min, max] (min and max included)
/**
* @brief Draws an integer number uniformly in range [min, max] (min and max included)
@@
-85,8
+83,7
@@
public:
*/
class XBT_PUBLIC StdRandom : public Random {
public:
*/
class XBT_PUBLIC StdRandom : public Random {
public:
- StdRandom() = default;
- explicit StdRandom(int seed) : Random(seed) {}
+ using Random::Random;
int uniform_int(int min, int max) override;
double uniform_real(double min, double max) override;
int uniform_int(int min, int max) override;
double uniform_real(double min, double max) override;
@@
-100,8
+97,7
@@
public:
*/
class XBT_PUBLIC XbtRandom : public Random {
public:
*/
class XBT_PUBLIC XbtRandom : public Random {
public:
- XbtRandom() = default;
- explicit XbtRandom(int seed) : Random(seed) {}
+ using Random::Random;
int uniform_int(int min, int max) override;
double uniform_real(double min, double max) override;
int uniform_int(int min, int max) override;
double uniform_real(double min, double max) override;
@@
-127,12
+123,12
@@
void set_mersenne_seed(int);
/**
* @brief Read the state of the Mersenne-Twister RNG from a file.
*/
/**
* @brief Read the state of the Mersenne-Twister RNG from a file.
*/
-bool read_mersenne_state(
std::string
filename);
+bool read_mersenne_state(
const std::string&
filename);
/**
* @brief Write the state of the Mersenne-Twister RNG to a file.
*/
/**
* @brief Write the state of the Mersenne-Twister RNG to a file.
*/
-bool write_mersenne_state(
std::string
filename);
+bool write_mersenne_state(
const std::string&
filename);
/**
* @brief Draws an integer number uniformly in range [min, max] (min and max included)
/**
* @brief Draws an integer number uniformly in range [min, max] (min and max included)
@@
-164,8
+160,6
@@
double exponential(double lambda);
* @param sd Standard deviation of the normal distribution
*/
double normal(double mean, double sd);
* @param sd Standard deviation of the normal distribution
*/
double normal(double mean, double sd);
-} // namespace random
-} // namespace xbt
-} // namespace simgrid
+} // namespace simgrid::xbt::random
#endif
#endif