function [fi,psi,alfa,teta,iy,iv,iseed] = angles(nmodes,iseed,iy,iv) %function [fi,psi,alfa,teta,iy,iv] = angles(nmodes,iseed,iy,iv) %corrected 11 May 2014 ang=zeros(nmodes,1); [fi,iseed,iy,iv]=randf_1(nmodes,0,2*pi,iseed,iy,iv); [psi,iseed,iy,iv]=randf_1(nmodes,0,2*pi,iseed,iy,iv); [alfa,iseed,iy,iv]=randf_1(nmodes,0,2*pi,iseed,iy,iv); [ang,iseed,iy,iv]=randf_1(nmodes,0,1,iseed,iy,iv); for m=1:nmodes % ang lies in the intervall 0 < ang < 1; make teta lie in the intervall 0 < ang < pi % acos(a)=asin(-a)+pi/2 teta(m)=acos(1-ang(m)/0.5); end