easy ways to sample from various probability distributions More...
#include "vnl/vnl_export.h"Go to the source code of this file.
Functions | |
| VNL_EXPORT void | vnl_sample_reseed () |
| re-seed the random number generator. More... | |
| VNL_EXPORT void | vnl_sample_reseed (int seed) |
| re-seed the random number generator given a seed. More... | |
| VNL_EXPORT double | vnl_sample_uniform01 () |
| return a random number uniformly drawn on [0, 1.0). More... | |
| VNL_EXPORT double | vnl_sample_uniform (double a, double b) |
| return a random number uniformly drawn on [a, b). More... | |
| VNL_EXPORT void | vnl_sample_normal_2 (double *x, double *y) |
| two independent samples from a standard normal distribution. More... | |
| VNL_EXPORT double | vnl_sample_normal (double mean, double sigma) |
| Normal distribution with given mean and standard deviation. More... | |
| VNL_EXPORT int | vnl_sample_binomial (int n, double q) |
| Return random k, where P(X = k) = [kth term in binomial expansion of (q + (1-q))^n]. More... | |
| VNL_EXPORT int | vnl_sample_bernoulli (double q) |
| Bernoulli distribution ("coin toss"). More... | |
| template<class I > | |
| void | vnl_sample_uniform (I begin, I end, double a, double b) |
| handy function to fill a range of values. More... | |
| template<class I > | |
| void | vnl_sample_normal (I begin, I end, double mean, double sigma) |
| handy function to fill a range of values. More... | |
| template<class I > | |
| void | vnl_sample_binomial (I begin, I end, int n, double q) |
| handy function to fill a range of values. More... | |
| template<class I > | |
| void | vnl_sample_bernoulli (I begin, I end, double q) |
| handy function to fill a range of values. More... | |
| template<class I , class T > | |
| void | vnl_sample_uniform (I begin, I end, double a, double b, T) |
| handy function to fill a range of values. More... | |
| template<class I , class T > | |
| void | vnl_sample_normal (I begin, I end, double mean, double sigma, T) |
| handy function to fill a range of values. More... | |
easy ways to sample from various probability distributions
Definition in file vnl_sample.h.
| VNL_EXPORT int vnl_sample_bernoulli | ( | double | q | ) |
Bernoulli distribution ("coin toss").
The returned value will be 0 (with probability q) or 1 (with probability 1-q). For a "fair" coin toss, use q=0.5. When q does not lie between 0 and 1, the value -1 is returned.
Definition at line 49 of file vnl_sample.cxx.
|
inline |
handy function to fill a range of values.
Definition at line 73 of file vnl_sample.h.
| VNL_EXPORT int vnl_sample_binomial | ( | int | n, |
| double | q | ||
| ) |
Return random k, where P(X = k) = [kth term in binomial expansion of (q + (1-q))^n].
The returned value will lie between 0 and n (but will be -1 when input is nonsense).
Definition at line 60 of file vnl_sample.cxx.
|
inline |
handy function to fill a range of values.
Definition at line 65 of file vnl_sample.h.
| VNL_EXPORT double vnl_sample_normal | ( | double | mean, |
| double | sigma | ||
| ) |
Normal distribution with given mean and standard deviation.
Definition at line 41 of file vnl_sample.cxx.
|
inline |
handy function to fill a range of values.
Definition at line 57 of file vnl_sample.h.
|
inline |
handy function to fill a range of values.
Definition at line 89 of file vnl_sample.h.
| VNL_EXPORT void vnl_sample_normal_2 | ( | double * | x, |
| double * | y | ||
| ) |
two independent samples from a standard normal distribution.
Definition at line 30 of file vnl_sample.cxx.
| VNL_EXPORT void vnl_sample_reseed | ( | ) |
re-seed the random number generator.
Definition at line 9 of file vnl_sample.cxx.
| VNL_EXPORT void vnl_sample_reseed | ( | int | seed | ) |
re-seed the random number generator given a seed.
Definition at line 14 of file vnl_sample.cxx.
| VNL_EXPORT double vnl_sample_uniform | ( | double | a, |
| double | b | ||
| ) |
return a random number uniformly drawn on [a, b).
Definition at line 19 of file vnl_sample.cxx.
|
inline |
handy function to fill a range of values.
Definition at line 49 of file vnl_sample.h.
|
inline |
handy function to fill a range of values.
Definition at line 81 of file vnl_sample.h.
| VNL_EXPORT double vnl_sample_uniform01 | ( | ) |
return a random number uniformly drawn on [0, 1.0).
Definition at line 25 of file vnl_sample.cxx.
1.8.15