一个用MATLAB语言编写的摄像机标定工具箱,内容丰富
源代码在线查看: random.h
//
// random.h
//
// $Id: random.h,v 1.1.1.1 2001/02/28 00:28:38 cstolte Exp $
//
#ifndef SGL_RANDOM_H
#define SGL_RANDOM_H
#include
class Vector2;
class Vector3;
class Random {
public:
Random(); // initialize from clock
Random(int seed); // initialize from user seed
virtual ~Random();
void init(int seed);
//
// Marsaglia's subtract-with-borrow generator
// (The Annals of Applied Probability, 1991, 1(3), 462-480)
// from code by J. Reeds 91/11/19.
//
// Augmented by Bays & Durham's output shuffling.
//
int int31();
int simpleInt31();
//
// uniform random integer from 0 to n-1
//
int integer(int n);
//
// uniform distribution in [0, 1.0)
//
double uniform();
double uniform() const { return ((Random *)this)->uniform(); }
//
// uniform points in unit disk
// (first version returns xp^2 + yp^2)
//
double disk(double *xp, double *yp);
Vector2 disk();
//
// normal distribution
//
double normal(double sigma, double mean);
//
// random 2D unit vector
//
void vector2(double *x, double *y);
Vector2 vector2();
//
// random 3D unit vector
//
void vector3(double *x, double *y, double *z);
Vector3 vector3();
double exponential(double mu);
double gamma(double a);
double beta(double a, double b);
double chi(double nu);
double Fdist(double nu1, double nu2);
double tdist(double nu);
int geometric(double p);
int binomial(double p, int trials);
int poisson(double mu);
protected:
//
// physically-random initial state
//
int vec[48];
int feed, tap, borrow;
int V[571], Y;
};
#endif // SGL_RANDOM_H