COSMOS v7.655  COSMOSv7655
(AirShowerMC)
kcossn.f
Go to the documentation of this file.
1 ! testing kcossn
2 ! include 'rnd.f'
3 ! ---------------
4 ! implicit none
5 ! integer i
6 ! real*8 cs, sn
7 ! do i=1, 50000
8 ! call kcossn(cs, sn)
9 ! write(*, *) sngl(asin(sn))
10 ! enddo
11 ! end
12  subroutine kcossn(cs,sn)
13 ! to generate cos(phy),sin(phy), where phy is uniform in (0,2pi).
14 ! reuired subprogram. rndc
15  implicit none
16  real*8 cs, sn
17 !
18  real*8 u, v, a, b, c
19  c = 5.d0
20 
21  do while (c .gt. 1.d0)
22  call rndc(u)
23  call rndc(v)
24  v=v+v-1.
25  a=u*u
26  b=v*v
27  c=a+b
28  enddo
29 
30  cs=(a-b)/c
31  sn=2.*u*v/c
32  end
subroutine rndc(u)
Definition: rnd.f:91
block data cblkEvhnp ! currently usable models data RegMdls ad *special data *Cekaon d0
Definition: cblkEvhnp.h:5
subroutine kcossn(cs, sn)
Definition: kcossn.f:13