dnl dnl File : rng_h.m4 dnl Author : Richard A. O'Keefe dnl SCCS : "%Z%%E% %M% %I%" dnl Purpose: Run this through M4 to generate the header for a random dnl number generator. dnl dnl The random number generator described here is based on the dnl PragmARC.Universal_Random generator, which is copyright 2000 dnl by PragmAda Software Engineering and released under the GPL. dnl It can be used for any of the three floating point types dnl available in C: dnl m4 -DT=float rng_h.m4 >rngf.h dnl m4 -DT=double rng_h.m4 >rng.h dnl m4 -DT='long double' rng_h.m4 >rngl.h dnl ifelse(T,float,`define(suffix,f)define(SUFFIX,F)', T,double,`define(suffix,)define(SUFFIX,)', T,long double,`define(suffix,l)define(SUFFIX,L)', T,T,`define(T,double)define(suffix,)define(SUFFIX,)')dnl define(TAG, RNG`'SUFFIX)dnl dnl `#ifndef' TAG`'_H `#define' TAG`'_H 2007 `#include' typedef struct TAG { int i, j; T c, u[97]; } TAG; extern TAG *new_`'TAG`'(void); /* seed always same */ extern TAG *new_`'TAG`'_now(void); /* seed from date+time */ extern TAG *new_`'TAG`'_from(unsigned long); /* seed is argument */ extern void free_`'TAG`'(TAG *); extern TAG *read_`'TAG`'(FILE *); /* read & allocate */ extern int write_`'TAG`'(FILE *, TAG const *); extern T urandom`'suffix`'(TAG *); /* uniform (0,1) */ extern T brandom`'suffix`'(TAG *, T, T); /* bounded (L,U) */ extern int irandom`'suffix`'(TAG *, int, int); `#'endif /* TAG`'_H */