program prog09 c This program analyzes the distribution of random numbers [0,1) c generated by c function rnd c implicit real*8(a-h,o-z) integer*4 iseed c dimension = vector dimension hist(50) c Initialization iseed = 123456789 n = 100000 dx = 1.0d0/50 do j = 1,50 hist(j) = 0.0d0 end do c Make Histograms do i = 1,n x = rnd(iseed) j = int(x/dx)+1 hist(j) = hist(j) + 1.0d0 end do c Output do j = 1,50 write(*,100) dx*(j-0.5d0),hist(j)/n/dx end do 100 format(2(1x,f10.4)) end c ********************************************************************** function rnd(iseed) c ********************************************************************** implicit real*8(a-h,o-z) c...32 bit (=4byte) machine integer*4 iseed,il,ic,ih il = 843314861 ic = 453816693 ih = 2**30 xmax = 2.0d0**31 c iseed = iseed*il + ic if(iseed.lt.0) iseed = (iseed + ih) + ih rnd = iseed/xmax c end