A source of pseudorandom numbers.
More...
#include <random.h>
|
|
| random_source (uint64_t seed) |
| | Construct a random engine with the given seed.
|
| |
|
uint64_t | get_seed () |
| | Get the seed used to generate the random source.
|
| |
|
uint64_t | natural () |
| | Generate a random natural number.
|
| |
| real_t | uniform (real_t a, real_t b) |
| | Generate a uniformly distributed random number.
|
| |
| template<typename Vector > |
| Vector & | uniform (Vector &x, real_t a, real_t b) |
| | Fill an already allocated vector with uniformly distributed numbers over the same interval.
|
| |
| template<typename Vector > |
| Vector & | uniform (Vector &x, const std::vector< prec::interval > intervals) |
| | Fill an already allocated vector with uniformly distributed numbers over different intervals.
|
| |
| real_t | gaussian (real_t mean, real_t sigma) |
| | Generate a Gaussian distributed random number.
|
| |
| template<typename Vector > |
| Vector & | gaussian (Vector &x, real_t mean, real_t sigma) |
| | Fill an already allocated vector with Gaussian distributed numbers with the same mean and standard deviation.
|
| |
| std::string | string (size_t length) |
| | Generate a random string made of human-readable ASCII characters.
|
| |
| std::string | string (size_t length, std::string alphabet) |
| | Generate a random string made of the elements of the given alphabet.
|
| |
| std::string | string (size_t length, std::vector< char > alphabet) |
| | Generate a random string made of the elements of the given alphabet.
|
| |
| template<typename T > |
| std::vector< T > | string (size_t length, std::vector< T > alphabet) |
| | Generate a random string made of the elements of the given alphabet, of arbitrary type.
|
| |
A source of pseudorandom numbers.
Can be automatically generated from a random_context by using get_rnd().
◆ gaussian() [1/2]
Generate a Gaussian distributed random number.
- Parameters
-
| m | The mean of the distribution |
| s | The standard deviation of the distribution |
- Returns
- A pseudorandom number Gaussian distributed.
◆ gaussian() [2/2]
Fill an already allocated vector with Gaussian distributed numbers with the same mean and standard deviation.
- Parameters
-
| x | The already initialized vector to fill. |
| m | The mean of the distribution |
| s | The standard deviation of the distribution |
- Returns
- A reference to the overwritten vector.
◆ string() [1/4]
| std::string chebyshev::random::random_source::string |
( |
size_t |
length | ) |
|
|
inline |
Generate a random string made of human-readable ASCII characters.
- Parameters
-
| length | The length of the string to generate |
- Returns
- A string generated by choosing the elements of the alphabet with uniform probability.
◆ string() [2/4]
| std::string chebyshev::random::random_source::string |
( |
size_t |
length, |
|
|
std::string |
alphabet |
|
) |
| |
|
inline |
Generate a random string made of the elements of the given alphabet.
- Parameters
-
| length | The length of the string to generate |
| alphabet | A string containing the elements of the alphabet. |
- Returns
- A string generated by choosing the elements of the alphabet with uniform probability.
◆ string() [3/4]
| std::string chebyshev::random::random_source::string |
( |
size_t |
length, |
|
|
std::vector< char > |
alphabet |
|
) |
| |
|
inline |
Generate a random string made of the elements of the given alphabet.
- Parameters
-
| length | The length of the string to generate. |
| alphabet | A vector containing the elements of the alphabet. |
- Returns
- A string generated by choosing the elements of the alphabet with uniform probability.
◆ string() [4/4]
| std::vector< T > chebyshev::random::random_source::string |
( |
size_t |
length, |
|
|
std::vector< T > |
alphabet |
|
) |
| |
|
inline |
Generate a random string made of the elements of the given alphabet, of arbitrary type.
- Parameters
-
| length | The length of the string to generate |
- Returns
- A vector generated by choosing the elements of the alphabet with uniform probability.
◆ uniform() [1/3]
Generate a uniformly distributed random number.
- Parameters
-
| a | The lower extreme of the interval |
| b | The upper extreme of the interval |
- Returns
- A pseudorandom number uniformly distributed over (a, b).
◆ uniform() [2/3]
Fill an already allocated vector with uniformly distributed numbers over different intervals.
- Parameters
-
| x | The already initialized vector to fill. |
| intervals | The intervals to generate over. |
- Returns
- A reference to the overwritten vector.
◆ uniform() [3/3]
Fill an already allocated vector with uniformly distributed numbers over the same interval.
- Parameters
-
| x | The already initialized vector to fill. |
| a | The lower extreme of the interval |
| b | The upper extreme of the interval |
- Returns
- A reference to the overwritten vector.
The documentation for this class was generated from the following file: