Functions
core/vnl/vnl_sample.cxx File Reference
#include "vnl_sample.h"
#include <vnl/vnl_math.h>
#include <vcl_cmath.h>
#include <vxl_config.h>
#include <vcl_ctime.h>

Go to the source code of this file.

Functions

void vnl_sample_reseed ()
 re-seed the random number generator.
void vnl_sample_reseed (int seed)
 re-seed the random number generator given a seed.
double vnl_sample_uniform (double a, double b)
 return a random number uniformly drawn on [a, b).
void vnl_sample_normal_2 (double *x, double *y)
 two independent samples from a standard normal distribution.
double vnl_sample_normal (double mean, double sigma)
 Normal distribution with given mean and standard deviation.
int vnl_sample_bernoulli (double q)
 Bernoulli distribution ("coin toss").
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].

Function Documentation

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 72 of file vnl_sample.cxx.

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 83 of file vnl_sample.cxx.

double vnl_sample_normal ( double  mean,
double  sigma 
)

Normal distribution with given mean and standard deviation.

Definition at line 64 of file vnl_sample.cxx.

void vnl_sample_normal_2 ( double *  x,
double *  y 
)

two independent samples from a standard normal distribution.

Definition at line 53 of file vnl_sample.cxx.

void vnl_sample_reseed ( )

re-seed the random number generator.

Definition at line 22 of file vnl_sample.cxx.

void vnl_sample_reseed ( int  seed)

re-seed the random number generator given a seed.

Definition at line 31 of file vnl_sample.cxx.

double vnl_sample_uniform ( double  a,
double  b 
)

return a random number uniformly drawn on [a, b).

Definition at line 40 of file vnl_sample.cxx.