c-----------------------------------------------------------
c Chapter 2: Random subset of an n-set(p23)
c-----------------------------------------------------------
c   Name of subroutine: RANSUB
c
c   Algorithm:Generating random subsets of set {1,2,...,n} 
c
c   input: n=5 
c   number of calls: run=50
c   complier: f77 ransub.f
c-----------------------------------------------------------

      parameter(n=5,run=50)
      integer a(n)
      do 25 j=1, run 
      call ransub(n,a)
      write(*,*), (a(i),i=1,n) 
25    continue
      stop
      end

c-----Subroutine begins here--------------------------------
      subroutine ransub(n,a)
      integer a(n)
      do 10  i=1,5
   10 a(i)=2.*rand(iseed) 
      return
      end

