More PRNG rationalization

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6274 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2015-12-15 01:36:05 +00:00
parent 00f78dd646
commit 3962a3514a
13 changed files with 30 additions and 8 deletions

View File

@ -416,6 +416,7 @@ set_source_files_properties (${ka9q_CSRCS} PROPERTIES COMPILE_FLAGS -Wno-sign-co
set (wsjt_CSRCS set (wsjt_CSRCS
${ka9q_CSRCS} ${ka9q_CSRCS}
lib/ftrsd/ftrsd2.c lib/ftrsd/ftrsd2.c
lib/sgran.c
lib/gran.c lib/gran.c
lib/igray.c lib/igray.c
lib/init_random_seed.c lib/init_random_seed.c

View File

@ -41,6 +41,9 @@ program JTMSKsim
phi0=0. phi0=0.
sig=10.0**(0.05*snrdb) sig=10.0**(0.05*snrdb)
call init_random_seed(1) ! seed Fortran RANDOM_NUMBER generator
call sgran() ! see C rand generator (used in gran)
! Generate the Tx waveform ! Generate the Tx waveform
cb11=0. cb11=0.
do j=1,234 do j=1,234

View File

@ -42,6 +42,8 @@ program chkfft
call getarg(5,arg) call getarg(5,arg)
read(arg,*) npatience read(arg,*) npatience
call sgran()
if(list) write(*,1000) infile,nr,nw,ncomplex,npatience if(list) write(*,1000) infile,nr,nw,ncomplex,npatience
1000 format(/'infile: ',a12,' nr:',i2,' nw',i2,' nc:',i2,' np:',i2/) 1000 format(/'infile: ',a12,' nr:',i2,' nw',i2,' nc:',i2,' np:',i2/)
if(.not.list) write(*,1002) nfft,nr,nw,ncomplex,npatience if(.not.list) write(*,1002) nfft,nr,nw,ncomplex,npatience

View File

@ -33,6 +33,8 @@ program genmet
hist=0 hist=0
nerr=0 nerr=0
call sgran()
do iter=1,iters do iter=1,iters
do i=0,ntones-1 do i=0,ntones-1
r(i)=0. r(i)=0.

View File

@ -2,7 +2,7 @@
#define INIT_RANDOM_SEED_H__ #define INIT_RANDOM_SEED_H__
#ifdef __cplusplus #ifdef __cplusplus
exten "C" { extern "C" {
#endif #endif
/* /*

View File

@ -45,7 +45,8 @@ program jt4sim
freq=f0 !Silence compiler warning freq=f0 !Silence compiler warning
dphi=0.0 !Silence compiler warning dphi=0.0 !Silence compiler warning
call init_random_seed() call init_random_seed(1) ! seed Fortran RANDOM_NUMBER generator
call sgran() ! see C rand generator (used in gran)
h=default_header(12000,npts) h=default_header(12000,npts)

View File

@ -35,7 +35,8 @@ program jt65sim
go to 999 go to 999
endif endif
call init_random_seed(1) call init_random_seed(1) ! seed Fortran RANDOM_NUMBER generator
call sgran() ! see C rand generator (used in gran)
csubmode='A' csubmode='A'
call getarg(1,csubmode) call getarg(1,csubmode)

View File

@ -67,6 +67,9 @@ program jt9sim
! if(minutes.eq.30) f0=1025. ! if(minutes.eq.30) f0=1025.
call init_random_seed(1) ! seed Fortran RANDOM_NUMBER generator
call sgran() ! see C rand generator (used in gran)
h=default_header(12000,npts) h=default_header(12000,npts)
k=0 !Silence compiler warning k=0 !Silence compiler warning

View File

@ -2,6 +2,9 @@ subroutine noisegen(d4,nmax)
real*4 d4(4,nmax) real*4 d4(4,nmax)
call init_random_seed(1) ! seed Fortran RANDOM_NUMBER generator
call sgran() ! see C rand generator (used in gran)
do i=1,nmax do i=1,nmax
d4(1,i)=gran() d4(1,i)=gran()
d4(2,i)=gran() d4(2,i)=gran()

View File

@ -1,8 +1,7 @@
#include "init_random_seed.h" #include "init_random_seed.h"
/* seed rand */ /* Fortran wrapper to seed the C library rand */
float sgran_() void sgran_(void)
{ {
init_random_seed(); init_random_seed();
return(0);
} }

View File

@ -23,7 +23,9 @@ program t1
call getarg(3,arg) call getarg(3,arg)
read(arg,*) iters read(arg,*) iters
call init_random_seed() call init_random_seed(1) ! seed Fortran RANDOM_NUMBER generator
call sgran() ! see C rand generator (used in gran)
call random_number(r) call random_number(r)
itone=0 itone=0
where(r.gt.0.5) itone=1 where(r.gt.0.5) itone=1

View File

@ -19,6 +19,8 @@ program timefft
lthreading=maxthreads.ge.1 lthreading=maxthreads.ge.1
maxthreads=max(1,maxthreads) maxthreads=max(1,maxthreads)
call sgran() ! see C rand generator (used in gran)
! Allocate data arrays ! Allocate data arrays
pa=fftwf_alloc_complex(int(nfft,C_SIZE_T)) pa=fftwf_alloc_complex(int(nfft,C_SIZE_T))
call c_f_pointer(pa,a,[nfft]) call c_f_pointer(pa,a,[nfft])

View File

@ -28,6 +28,7 @@
#include "SettingsGroup.hpp" #include "SettingsGroup.hpp"
#include "TraceFile.hpp" #include "TraceFile.hpp"
#include "mainwindow.h" #include "mainwindow.h"
#include "lib/init_random_seed.h"
namespace namespace
{ {
@ -44,6 +45,8 @@ namespace
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
init_random_seed ();
register_types (); // make the Qt magic happen register_types (); // make the Qt magic happen
// Multiple instances: // Multiple instances: