X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/17b1ceac50e719326453d85b33d0a43c6e98bbba..037217ec2176ada8eb05cd8e5f5b63e7440c63a3:/include/xbt/random.hpp diff --git a/include/xbt/random.hpp b/include/xbt/random.hpp index 12a9fe9b7c..c55ba8b713 100644 --- a/include/xbt/random.hpp +++ b/include/xbt/random.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2019. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2019-2020. 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. */ @@ -6,24 +6,55 @@ #ifndef SIMGRID_XBT_RANDOM_HPP #define SIMGRID_XBT_RANDOM_HPP -#include - namespace simgrid { namespace xbt { namespace random { -enum xbt_random_method { XBT_RNG_xbt, XBT_RNG_std }; - -void use_xbt(); -void use_std(); -int uniform_int(int, int); -int xbt_uniform_int(int, int); -double uniform_real(double, double); -double xbt_uniform_real(double, double); -double exponential(double); -double xbt_exponential(double); -double normal(double, double); -double xbt_normal(double, double); + +/** + * @brief Tells xbt/random to use the ad-hoc distribution implementation. + */ +void set_implem_xbt(); + +/** + * @brief Tells xbt/random to use the standard library distribution implementation. + */ +void set_implem_std(); + +/** + * @brief Sets the seed of the Mersenne-Twister RNG + */ void set_mersenne_seed(int); + +/** + * @brief Draws an integer number uniformly in range [min, max] (min and max included) + * + * @param min Minimum value + * @param max Maximum value + */ +int uniform_int(int min, int max); + +/** + * @brief Draws a real number uniformly in range [min, max) (min included, and max excluded) + * + * @param min Minimum value + * @param max Maximum value + */ +double uniform_real(double min, double max); + +/** + * @brief Draws a real number according to the given exponential distribution + * + * @param lambda Parameter of the exponential law + */ +double exponential(double lambda); + +/** + * @brief Draws a real number according to the given normal distribution + * + * @param mean Mean of the normal distribution + * @param sd Standard deviation of the normal distribution + */ +double normal(double mean, double sd); } // namespace random } // namespace xbt } // namespace simgrid