Example for use of the subroutine randfi.f in Fortran90

This is an example of the main program how to use the subroutine randfi.f. First, the example calls the initialization subroutine RMARIN with two initial integer numbers. Second, the main program calls twice the own generator of the random numbers, the routine RANMAR. Input variables to the RAMMAR is a field of the random numbers and a lenght of this field.
[Download of the example (2.0 kB)]
The random number generator computes 20000 numbers and then the next six random numbers should be:
           6533892.0    14220222.0    7275067.0
           6172232.0     8354498.0   10633180.0


        program TstRAN
c
c Declarations:
        double precision, dimension (200) :: temp
        integer :: init1, init2, len
100   format (3F12.1)
c These are the seeds needed to produce the test case results.
        init1 = 1802
        init2 = 9373
c Do the initialization.
        call RMARIN(init1,init2)
c
c Generate 20000 random numbers.
        len = 100
        do i = 1, 200
           call RANMAR(temp,len)
        end do
c
        len=6
           call RANMAR(temp,len)
        print 100, (4096.0*4096.0*temp(i), i=1,6)
        end

[ Back ] Copyright © karolkalna
The page is designed using the Cascading Style Sheets (CSS).