mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-07-30 20:52:28 -04:00
Change random number generation in qra66sim so results are exactly repeateble.
This commit is contained in:
parent
fb3c23492f
commit
45dac5bd18
@ -26,3 +26,9 @@ float gran_()
|
|||||||
iset++;
|
iset++;
|
||||||
return v2*fac;
|
return v2*fac;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Generates evenly distributed numbers between 0 and 1. */
|
||||||
|
float rran_()
|
||||||
|
{
|
||||||
|
return (float)rand()/(float)RAND_MAX;
|
||||||
|
}
|
||||||
|
@ -110,15 +110,13 @@ program qra66sim
|
|||||||
a=0.
|
a=0.
|
||||||
if(x.lt.3.0) then !Cutoff beyond x=3
|
if(x.lt.3.0) then !Cutoff beyond x=3
|
||||||
a=sqrt(1.111/(1.0+x*x)-0.1) !Lorentzian amplitude
|
a=sqrt(1.111/(1.0+x*x)-0.1) !Lorentzian amplitude
|
||||||
call random_number(r1)
|
phi1=twopi*rran() !Random phase
|
||||||
phi1=twopi*r1 !Random phase
|
|
||||||
z=a*cmplx(cos(phi1),sin(phi1))
|
z=a*cmplx(cos(phi1),sin(phi1))
|
||||||
endif
|
endif
|
||||||
cspread(i)=z
|
cspread(i)=z
|
||||||
z=0.
|
z=0.
|
||||||
if(x.lt.3.0) then !Same thing for negative freqs
|
if(x.lt.3.0) then !Same thing for negative freqs
|
||||||
call random_number(r2)
|
phi2=twopi*rran()
|
||||||
phi2=twopi*r2
|
|
||||||
z=a*cmplx(cos(phi2),sin(phi2))
|
z=a*cmplx(cos(phi2),sin(phi2))
|
||||||
endif
|
endif
|
||||||
cspread(NFFT-i)=z
|
cspread(NFFT-i)=z
|
||||||
|
Loading…
x
Reference in New Issue
Block a user