Mercurial > hg > plcrp
annotate rndutils.h @ 0:b31415b4a196
Initial check in.
author | samer |
---|---|
date | Fri, 20 Jan 2012 16:58:52 +0000 |
parents | |
children |
rev | line source |
---|---|
samer@0 | 1 #include <stdio.h> |
samer@0 | 2 #include "RngStream.h" |
samer@0 | 3 |
samer@0 | 4 // random generator state |
samer@0 | 5 typedef struct { |
samer@0 | 6 struct rng_state g; |
samer@0 | 7 double prev_normal; |
samer@0 | 8 } RndState; |
samer@0 | 9 |
samer@0 | 10 typedef struct { |
samer@0 | 11 struct rng_jump j; |
samer@0 | 12 int e; |
samer@0 | 13 } RndJump; |
samer@0 | 14 |
samer@0 | 15 int randomise_from(FILE *p, RndState *S); |
samer@0 | 16 int spawn_gen(RndState *S0, RndState *S1); |
samer@0 | 17 void InitRndState(RndState *S); |
samer@0 | 18 |
samer@0 | 19 double Raw(RndState *); |
samer@0 | 20 double Uniform(RndState *); |
samer@0 | 21 double Normal(RndState *); |
samer@0 | 22 double Exponential(RndState *); |
samer@0 | 23 double Gamma(RndState *,double a); |
samer@0 | 24 long Poisson(RndState *,double a); |
samer@0 | 25 int Dirichlet(RndState *,long n, double *a, double *x); |
samer@0 | 26 double Beta(RndState *,double a, double b); |
samer@0 | 27 double Zeta(RndState *,double a); |
samer@0 | 28 int Binomial(RndState *,double p, int n); |
samer@0 | 29 double Stable(RndState *,int param,double a, double b); |
samer@0 | 30 long Discrete(RndState *, long n, double *p, double tot); |
samer@0 | 31 |