Date: 2013-07-02T14:39:25+00:00

Actual source code: ex6f.F
petsc-3.4.2 2013-07-02

      1: !
      2: !  Progran to test random number generation routines from fortran.
      3: !
      4:        program main
      5: #include <finclude/petscsys.h>
      6:       PetscErrorCode  ierr
      7:       PetscRandom     r
      8:       PetscScalar     rand

     10:       call PetscInitialize(PETSC_NULL_CHARACTER,ierr)
     11:       if (ierr .ne. 0) then
     12:          print*, 'Unable to begin PETSc program'
     13:       endif

     15:       call PetscRandomCreate(PETSC_COMM_WORLD,r,ierr)
     16:       call PetscRandomSetFromOptions(r,ierr)
     17:       call PetscRandomGetValue(r,rand,ierr)
     18:       print*, 'Random value:',rand

     20:       call PetscRandomDestroy(r,ierr)
     21:       call PetscFinalize(ierr)
     22:       end