00001 00009 #ifndef _RANDOM_H 00010 #define _RANDOM_H 00011 00012 #include "platform.h" 00013 00014 typedef enum { 00015 RT_INVALID=-1, 00016 RT_DEGENERATE, 00017 RT_UNIFORM, 00018 RT_NORMAL, 00019 RT_LOGNORMAL, 00020 RT_BERNOULLI, 00021 RT_PARETO, 00022 RT_EXPONENTIAL, 00023 RT_SAMPLED, 00024 RT_RAYLEIGH, 00025 RT_WEIBULL, 00026 RT_GAMMA, 00027 RT_BETA, 00028 RT_TRIANGLE, 00029 } RANDOMTYPE; 00030 00031 #ifdef __cplusplus 00032 extern "C" { 00033 #endif 00034 int random_init(void); 00035 int random_test(void); 00036 int randwarn(void); 00037 double randunit(void); 00038 double random_degenerate(double a); 00039 double random_uniform(double a, double b); 00040 double random_normal(double m, double s); 00041 double random_bernoulli(double p); 00042 double random_sampled(unsigned int n, double *x); 00043 double random_pareto(double base, double gamma); 00044 double random_lognormal(double gmu, double gsigma); 00045 double random_exponential(double lambda); 00046 double random_functional(char *text); 00047 double random_beta(double alpha, double beta); 00048 double random_gamma(double alpha, double beta); 00049 double random_weibull(double l, double k); 00050 double random_rayleigh(double s); 00051 double random_triangle(double a, double b); 00052 double random_triangle_asy(double a, double b, double c); 00053 int random_apply(char *group_expression, char *property, RANDOMTYPE type, ...); 00054 RANDOMTYPE random_type(char *name); 00055 int random_nargs(char *name); 00056 double random_value(RANDOMTYPE type, ...); 00057 double pseudorandom_value(RANDOMTYPE, unsigned int *state, ...); 00058 #ifdef __cplusplus 00059 } 00060 #endif 00061 00062 #endif 00063