Go to the documentation of this file.
24 static long int random() {
return rand(); }
26 static void srandom(
unsigned int seed) {
return srand(seed); }
42 mgx_EXPORT
void sran(
unsigned int seed);
47 mgx_EXPORT
double ran(
double M);
51 mgx_EXPORT
long double ran(
long double M);
55 mgx_EXPORT
float ran(
float M);
60 template <
typename T>
double ran(T M) {
61 return ran(
double(M));
70 for(
size_t i = 0; i < dim; ++i)
71 result[i] =
ran(V[i]);
81 mgx_EXPORT
double gaussRan(
double mean,
double sigma);
94 for(
size_t i = 0; i < dim; ++i)
95 result[i] =
gaussRan(mean[i], sigma[i]);
102 mgx_EXPORT
long int ranInt();
116 template <
size_t dim,
typename T> Vector<dim, T>
ranInt()
118 Vector<dim, long int> result;
119 for(
size_t i = 0; i < dim; ++i)
120 result[i] = ranInt<T>();
127 template <
size_t dim> Vector<dim, long int>
ranInt() {
128 return ranInt<dim, long int>();
134 mgx_EXPORT
long int ranInt(
long int n);
143 for(
size_t i = 0; i < dim; ++i)
144 result[i] = ranInt<T>(
n[i]);
mgx_EXPORT double gaussRan(double mean, double sigma)
Generate a random number with gaussian distribution.
mgx_EXPORT void sran(unsigned int seed)
Initialize the random number generator.
mgx_EXPORT double ran(double M)
Generate a random number uniformly distributed between 0 and M.
mgx_EXPORT long int ranInt()
Returns a random number between 0 and RAND_MAX.
Distributed matrix library.
Namespace containing all the utility classes.
mgx_EXPORT unsigned int sran_time()
Initialize the random number with the current time of the day (in microsecond)