program mc
implicit none
real,allocatable,dimension(:) :: vec,val
real,allocatable,dimension(:) ::r1,r2
real :: num,r,tpi,g1
integer:: i,j,k

allocate(vec(1280000),val(1280000))
allocate(r1(640000),r2(640000))


call random_number(r1)
call random_number(r2)
tpi = 8.0e0*atan(1.0e0)
val = 1.0e0

do i = 1 , 640000
	g1 = sqrt(-2.0e0*log(r1(i)))*cos(tpi*r2(i))
	val(i) = exp(g1)*val(i)
end do
do i = 640001,1280000
	g1 = sqrt(-2.0e0*log(r1(i-640000)))*sin(tpi*r2(i-640000))
	val(i) = exp(g1)*val(i)
end do

stop
end
