Some of the GUDHI functionnalities are using randomness. Here is a list of classes and methods that are using internally Gudhi::random::get_default_random (and are thus affected by Gudhi::random::set_seed):
In order to reproduce the results, a specific GUDHI random generator is available, and one can set its seed:
#include <gudhi/random.h>
void set_seed(Random_generator::result_type seed)
Sets the seed for the default random engine.
Definition random.h:102
◆ Random_generator
◆ get_default_random()
Returns a thread-local default random number generator instance.
- Returns
- A reference to the thread-local default random instance.
◆ get_uniform()
template<typename Type, typename CustomRandomGenerator = Random_generator&>
| Type Gudhi::random::get_uniform |
( |
const Type & | min, |
|
|
const Type & | max, |
|
|
CustomRandomGenerator && | rng = get_default_random() ) |
Generates a random number in the range [min, max].
- Template Parameters
-
| Type | The type of the random number (must be integral or floating-point). |
| CustomRandomGenerator | The type of the random generator. Default is Random_generator. |
- Parameters
-
| min | The minimum value (inclusive). |
| max | The maximum value (inclusive for integral types, but exclusive for floating-point types). |
| rng | A random generator. Use the default one if not set. |
- Returns
- A random number of type
Type in the range [min, max].
◆ get_uniform_range()
template<typename Type, typename CustomRandomGenerator = Random_generator&>
| std::vector< Type > Gudhi::random::get_uniform_range |
( |
std::size_t | nbr, |
|
|
const Type & | min, |
|
|
const Type & | max, |
|
|
CustomRandomGenerator && | rng = get_default_random() ) |
Generates a vector of N random numbers in the range [min, max].
- Template Parameters
-
| Type | The type of the random numbers (must be integral or floating-point). |
| CustomRandomGenerator | The type of the random generator. Default is Random_generator. |
- Parameters
-
| nbr | The number of random numbers to generate. |
| min | The minimum value (inclusive). |
| max | The maximum value (inclusive for integral types, but exclusive for floating-point types). |
| rng | A random generator. Use the default one if not set. |
- Returns
- A vector of random numbers of type
Type in the range [min, max].
- Examples
- Random_bitmap_cubical_complex.cpp.
◆ set_seed()
| void Gudhi::random::set_seed |
( |
Random_generator::result_type | seed | ) |
|
Sets the seed for the default random engine.
- Parameters
-