diff --git a/src/frontend/inp.c b/src/frontend/inp.c index 89abf2c42..f689652f3 100644 --- a/src/frontend/inp.c +++ b/src/frontend/inp.c @@ -40,6 +40,7 @@ Author: 1985 Wayne A. Christopher #include "numparam/numpaif.h" #include "ngspice/stringskip.h" +#include "ngspice/randnumb.h" #define line_free(line, flag) \ diff --git a/src/frontend/numparam/xpressn.c b/src/frontend/numparam/xpressn.c index 1ec587c8b..87319115d 100644 --- a/src/frontend/numparam/xpressn.c +++ b/src/frontend/numparam/xpressn.c @@ -16,8 +16,7 @@ /* random numbers in /maths/misc/randnumb.c */ -extern double gauss0(void); -extern double drand(void); +#include "ngspice/randnumb.h" /************ keywords ************/ diff --git a/src/frontend/trannoise/wallace.c b/src/frontend/trannoise/wallace.c index 863768868..8421b2d19 100644 --- a/src/frontend/trannoise/wallace.c +++ b/src/frontend/trannoise/wallace.c @@ -20,6 +20,7 @@ #include #include "ngspice/wallace.h" #include "ngspice/FastNorm3.h" +#include "ngspice/randnumb.h" #define POOLSIZE 4096 #define LPOOLSIZE 12 @@ -42,11 +43,6 @@ static unsigned n = POOLSIZE; static double chi1, chi2; /* chi^2 correction values */ static unsigned int newpools; -extern double drand(void); -extern unsigned int CombLCGTausInt(void); -extern void TausSeed(void); -extern unsigned int CombLCGTausInt2(void); - void PolarGauss(double* py1, double* py2) diff --git a/src/include/ngspice/1-f-code.h b/src/include/ngspice/1-f-code.h index a4ecfd325..8cfd86237 100644 --- a/src/include/ngspice/1-f-code.h +++ b/src/include/ngspice/1-f-code.h @@ -1,8 +1,4 @@ - -extern double drand(void); -extern double exprand(double); -extern int poisson(double); -extern double gauss0(void); +#include "ngspice/randnumb.h" void f_alpha(int n_pts, int n_exp, double X[], double Q_d, double alpha); diff --git a/src/include/ngspice/fteext.h b/src/include/ngspice/fteext.h index 83f5489d7..b5ec9133d 100644 --- a/src/include/ngspice/fteext.h +++ b/src/include/ngspice/fteext.h @@ -277,8 +277,6 @@ extern struct plot *raw_read(char *name); extern bool do_measure(char *what, bool chk_only); extern bool check_autostop(char *what); -/* randnumb.c */ -extern void TausSeed(void); /* resource.c */ extern void ft_ckspace(void); diff --git a/src/include/ngspice/randnumb.h b/src/include/ngspice/randnumb.h new file mode 100644 index 000000000..d5c53c5e0 --- /dev/null +++ b/src/include/ngspice/randnumb.h @@ -0,0 +1,17 @@ +#ifndef ngspice_RANDNUMB_H +#define ngspice_RANDNUMB_H + +/* initialize random number generators */ +extern void initw(void); + +extern void checkseed(void); /* seed random or set by 'set rndseed=value'*/ +extern double drand(void); +extern double gauss0(void); +extern int poisson(double); +extern double exprand(double); + +extern void TausSeed(void); +extern unsigned int CombLCGTausInt(void); +extern unsigned int CombLCGTausInt2(void); + +#endif diff --git a/src/include/ngspice/wallace.h b/src/include/ngspice/wallace.h index 2c81bcfc7..2fd36898d 100644 --- a/src/include/ngspice/wallace.h +++ b/src/include/ngspice/wallace.h @@ -17,6 +17,4 @@ double NewWa(void); /* generate new pool, return outgauss[0] */ #define GaussWa ((--variate_used)?(outgauss[variate_used]*ScaleGauss):NewWa()) -void initw(void); /* initialization of Wallace generator */ - void PolarGauss(double* py1, double* py2); diff --git a/src/main.c b/src/main.c index 3d83ed4f1..a4e0b6fbc 100644 --- a/src/main.c +++ b/src/main.c @@ -52,6 +52,7 @@ extern int rl_catch_signals; /* missing from editline/readline.h */ #include "frontend/signal_handler.h" #include "frontend/misccoms.h" #include "ngspice/compatmode.h" +#include "ngspice/randnumb.h" /* saj xspice headers */ #ifdef XSPICE @@ -205,8 +206,6 @@ extern void OUTerrorf(int, const char *fmt, ...); extern int OUTattributes(runDesc *, IFuid, int, IFvalue *); -extern void initw(void); - IFfrontEnd nutmeginfo = { IFnewUid, IFdelUid, diff --git a/src/maths/cmaths/cmath2.c b/src/maths/cmaths/cmath2.c index 076735a5d..db010700b 100644 --- a/src/maths/cmaths/cmath2.c +++ b/src/maths/cmaths/cmath2.c @@ -18,18 +18,12 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group #include "ngspice/ngspice.h" #include "ngspice/cpdefs.h" #include "ngspice/dvec.h" +#include "ngspice/randnumb.h" #include "cmath.h" #include "cmath2.h" -extern void checkseed(void); /* seed random or set by 'set rndseed=value'*/ -extern double drand(void); /* from randnumb.c */ -extern double gauss0(void); /* from randnumb.c */ -extern int poisson(double); /* from randnumb.c */ -extern double exprand(double); /* from randnumb.c */ - - static double cx_max_local(void *data, short int type, int length) { diff --git a/src/maths/misc/randnumb.c b/src/maths/misc/randnumb.c index bc7433cb4..5daad2094 100644 --- a/src/maths/misc/randnumb.c +++ b/src/maths/misc/randnumb.c @@ -39,6 +39,7 @@ Copyright 2008 Holger Vogt #include "ngspice/ngspice.h" #include "ngspice/cpdefs.h" #include "ngspice/ftedefs.h" +#include "ngspice/randnumb.h" #include #include #include @@ -62,15 +63,8 @@ static unsigned LGCS(unsigned *state, unsigned A1, unsigned A2); double CombLCGTaus(void); float CombLCGTaus2(void); -unsigned int CombLCGTausInt(void); -unsigned int CombLCGTausInt2(void); -double exprand(double); -void checkseed(void); -double drand(void); -double gauss0(void); void rgauss(double* py1, double* py2); -int poisson(double); /* Check if a seed has been set by the command 'set rndseed=value' diff --git a/src/sharedspice.c b/src/sharedspice.c index 0e9490ea4..77c0a5824 100644 --- a/src/sharedspice.c +++ b/src/sharedspice.c @@ -60,6 +60,7 @@ myfputc(int inp, FILE* f) #include "ngspice/ngspice.h" #include "misc/misc_time.h" +#include "ngspice/randnumb.h" /*Use Windows threads if on W32 without pthreads*/ #ifndef HAVE_LIBPTHREAD @@ -170,7 +171,6 @@ extern void DevInit(void); extern int SIMinit(IFfrontEnd *frontEnd, IFsimulator **simulator); extern wordlist *cp_varwl(struct variable *var); extern void create_circbyline(char *line); -extern void initw(void); /*The current run (to get variable names, etc)*/ diff --git a/src/tclspice.c b/src/tclspice.c index b34e3b3c5..eea9c3d62 100644 --- a/src/tclspice.c +++ b/src/tclspice.c @@ -26,6 +26,7 @@ /**********************************************************************/ #include "ngspice/ngspice.h" +#include "ngspice/randnumb.h" #include "misc/misc_time.h" #include diff --git a/visualc/sharedspice.vcxproj b/visualc/sharedspice.vcxproj index cd1e2b954..9a40cd957 100644 --- a/visualc/sharedspice.vcxproj +++ b/visualc/sharedspice.vcxproj @@ -398,6 +398,7 @@ + diff --git a/visualc/vngspice-fftw.vcxproj b/visualc/vngspice-fftw.vcxproj index 42f1425ea..b4517fa76 100644 --- a/visualc/vngspice-fftw.vcxproj +++ b/visualc/vngspice-fftw.vcxproj @@ -1015,6 +1015,7 @@ lib /machine:x64 /def:..\..\fftw-3.3.4-dll64\libfftw3-3.def /out:$(IntDir)libfft + diff --git a/visualc/vngspice.vcxproj b/visualc/vngspice.vcxproj index 9f2c9b403..f8b777083 100644 --- a/visualc/vngspice.vcxproj +++ b/visualc/vngspice.vcxproj @@ -981,6 +981,7 @@ +