implicit real*8 (a-h,o-z) character*16 wname(100) integer ilen external ilen double precision weight(100),weightp(100),wspan(100),wlb(100) read(*,*) iseed,nwei iseed=-iabs(iseed) call vrndst(iseed) do i=1,100 read(*,*,end=10,err=10) wname(i),weight(i),wspan(i),wlb(i) print *,"i",i," wname ",wname(i)," weight",weight(i) enddo 10 n=i-1 do i=1,nwei write (*,'("Weight set",i3,t80,"&")') i il=0 do j=1,n bound_l = weight(j)-wspan(j) if (bound_l.lt.wlb(j)) bound_l=wlb(j) bound_r = weight(j)+wspan(j) weightp(j)=ran_number(bound_l,bound_r) ill=il il=il+ilen(wname(j))+9 if (il.gt.79) then write (*,'(a,$)') (' ',k=1,79-ill) write (*,'(1h&)') write(*,'(a,1h=,f7.5," ",$)') wname(j)(:ilen(wname(j))), & weightp(j) il=ilen(wname(j))+9 else write(*,'(a,1h=,f7.5," ",$)') wname(j)(:ilen(wname(j))), & weightp(j) endif enddo write (*,*) write (*,*) enddo end