! Copyright (c) 1994 Unicomp, Inc.
!
! Developed at Unicomp, Inc.
!
! Permission to use, copy, modify, and distribute this
! software is freely granted, provided that this notice 
! is preserved.

program seven_11

   implicit none
   integer, parameter :: number_of_rolls = 1000
   integer, dimension (number_of_rolls) ::  &
         dice, die_1, die_2
   integer :: wins

   call random_int (die_1, 1, 6)
   call random_int (die_2, 1, 6)
   dice = die_1 + die_2
   wins = count ((dice == 7) .or. (dice == 11))

   print "(a, f6.2)",  &
   "The percentage of rolls that are 7 or 11 is", &
   100.0 * real (wins) / real (number_of_rolls)

contains

subroutine random_int (result, low, high)

   integer, dimension (:), intent (out) :: result
   integer, intent (in) :: low, high
   real, dimension (size (result)) :: uniform_value

   call random_number (uniform_value)
   result =  &
   int ((high - low + 1) * uniform_value + low)

end subroutine random_int

end program seven_11
