program rand_prg
   real :: rnd
   real, dimension (:), allocatable :: x
   integer, dimension(2) :: seed, seed_old
   integer :: L,i,n_min,n_max,ran_int,sizer,seed1,seed2
!  generate random integers between n_min and n_max
!  dimension of seed is one in F and two in Fortran 90.
   call random_seed(sizer)
   print *, sizer
!  illustrate use of put and get
   read(0,*) seed1,seed2
   seed(1) = seed1        ! 1239
   seed(2) = seed2        ! need for Fortran 90
   call random_seed(put=seed)
   call random_seed(get=seed_old)
!  confirm value of seed
   print *, "seed = ", seed_old
   L = 100         ! length of sequence
   n_min = 1
   n_max = 10
   do i = 1,L
      call random_number(rnd)
      ran_int = (n_max - n_min + 1)*rnd + n_min
      print *,ran_int
   end do
!  assign random numbers to array x as another example
   allocate(x(L))
   call random_number(x)
   print "(4f13.6)", x
   call random_seed(get=seed_old)
   print *, "seed = ", seed_old
end program rand_prg


