00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __Random_h
00018 #define __Random_h
00019
00020 #if defined(__STDC__) || defined(__cplusplus)
00021 #define _(args) args
00022 #else
00023 #define _(args) ()
00024 #endif
00025
00026 #ifdef __cplusplus
00027 extern "C" {
00028 #endif
00029
00030
00031 #include "real.h"
00032
00033
00034
00035
00037 extern REAL genbet _((REAL aa,REAL bb));
00038 extern REAL genchi _((REAL df));
00039 extern REAL genexp _((REAL av));
00040 extern REAL sexpo _((void));
00041 extern REAL genf _((REAL dfn, REAL dfd));
00042 extern REAL gengam _((REAL a,REAL r));
00043 extern REAL sgamma _((REAL a));
00044 extern void genmn _((REAL *parm,REAL *x,REAL *work));
00045 extern REAL gennch _((REAL df,REAL xnonc));
00046 extern REAL gennf _((REAL dfn, REAL dfd, REAL xnonc));
00047 extern REAL gennor _((REAL av,REAL sd));
00048 extern REAL snorm1 _((void));
00049 extern REAL snorm2 _((void));
00050 extern REAL snorm3 _((void));
00051 extern REAL genunf _((REAL low,REAL high));
00052 extern long ignbin _((long n,REAL pp));
00053 extern long ignpoi _((REAL mu));
00054 extern long ignuin _((long low,long high));
00055 extern REAL rcauchy _((REAL alpha, REAL beta));
00056 extern REAL scauchy1 _((void));
00057
00058 #ifndef OLDSTYLE_RANLIB
00059 #define rbeta(a,b) genbet(a,b)
00060 #define rchi(a) genchi(a)
00061 #define rexp(a) genexp(a)
00062 #define rF(a,b) genf(a,b)
00063 #define rgamma(a,b) gengam(a,b)
00064 #define rmnorm(a,b,c) genmn(a,b,c)
00065 #define rnchi(a,b) gennch(a,b)
00066 #define rnF(a,b,c) gennf(a,b,c)
00067 #define rnorm(a,b) gennor(a,b)
00068 #define runif(a,b) genunf(a,b)
00069 #define rbinomial(a,b) ignbin(a,b)
00070 #define rpoisson(a) ignpoi(a)
00071 #define runifint(a,b) ignuin(a,b)
00072 #endif
00073
00074
00075 #ifdef __cplusplus
00076 };
00077 #endif
00078
00079
00080 #define snorm() snorm1()
00081
00082 #define ABS(x) ((x) >= 0 ? (x) : -(x))
00083 #ifndef MIN
00084 #define MIN(a,b) ((a) <= (b) ? (a) : (b))
00085 #endif
00086 #ifndef MAX
00087 #define MAX(a,b) ((a) >= (b) ? (a) : (b))
00088 #endif
00089
00090
00092 #include "LEC_rng.h"
00093
00094 #ifdef OLDSTYLE_RANLIB
00095 #define ranf() LEC_runif()
00096 #else
00097 #define ranf() (*global_runif)()
00098 #ifdef __cplusplus
00099 extern "C" {
00100 #endif
00101 extern REAL (*global_runif) _((void));
00102 #ifdef __cplusplus
00103 };
00104 #endif
00105 #define set_global_runif(func) global_runif = func
00106 #endif
00107
00108 #endif