MorphoGraphX
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Namespaces | Functions
Random.hpp File Reference

Defines various functions to generate random numbers. More...

#include <Config.hpp>
#include <Vector.hpp>

Go to the source code of this file.

Namespaces

 mgx
 This namespace contains all the API of MorphoGraphX.
 

Functions

mgx_EXPORT unsigned int mgx::util::sran_time ()
 Initialize the random number with the current time of the day (in microsecond) More...
 
mgx_EXPORT void mgx::util::sran (unsigned int seed)
 Initialize the random number generator.
 
mgx_EXPORT double mgx::util::ran (double M)
 Generate a random number uniformely distributed between 0 and M.
 
mgx_EXPORT long double mgx::util::ran (long double M)
 Generate a random number uniformely distributed between 0 and M.
 
mgx_EXPORT float mgx::util::ran (float M)
 Generate a random number uniformely distributed between 0 and M.
 
template<typename T >
double mgx::util::ran (T M)
 Generate a random number uniformely distributed between 0 and M.
 
template<size_t dim, typename T >
Vector< dim, T > mgx::util::ran (const Vector< dim, T > &V)
 Generate a random vector uniformely distributed between Vector(0) and V.
 
mgx_EXPORT double mgx::util::gaussRan (double mean, double sigma)
 Generate a random number with gaussian distribution. More...
 
template<size_t dim>
Vector< dim, double > mgx::util::gaussRan (const Vector< dim, double > &mean, const Vector< dim, double > &sigma)
 Generate a random vector with gaussian distribution. More...
 
mgx_EXPORT long int mgx::util::ranInt ()
 Returns a random number between 0 and RAND_MAX. More...
 
mgx_EXPORT long int mgx::util::ranInt (long int n)
 Returns a random number between 0 and n (excluded), for n <= RAND_MAX.
 
template<size_t dim, typename T >
Vector< dim, T > mgx::util::ranInt (const Vector< dim, T > &n)
 Returns a vector of random numbers. More...
 

Detailed Description

Defines various functions to generate random numbers.