xref: /petsc/src/sys/tests/ex6f.F90 (revision f84028053d197aff3fdf060e86d88b3f1b0f0110)
1*f8402805SBarry Smith!
2*f8402805SBarry Smith!  Program to test random number generation routines from fortran.
3*f8402805SBarry Smith!
4*f8402805SBarry Smith      program main
5*f8402805SBarry Smith
6*f8402805SBarry Smith#include <petsc/finclude/petscsys.h>
7*f8402805SBarry Smith      use petscsys
8*f8402805SBarry Smith      implicit none
9*f8402805SBarry Smith
10*f8402805SBarry Smith      PetscErrorCode  ierr
11*f8402805SBarry Smith      PetscRandom     r
12*f8402805SBarry Smith      PetscScalar     rand
13*f8402805SBarry Smith
14*f8402805SBarry Smith      PetscCallA(PetscInitialize(PETSC_NULL_CHARACTER,ierr))
15*f8402805SBarry Smith
16*f8402805SBarry Smith      PetscCallA(PetscRandomCreate(PETSC_COMM_WORLD,r,ierr))
17*f8402805SBarry Smith      PetscCallA(PetscRandomSetFromOptions(r,ierr))
18*f8402805SBarry Smith      PetscCallA(PetscRandomGetValue(r,rand,ierr))
19*f8402805SBarry Smith      print*, 'Random value:',rand
20*f8402805SBarry Smith      PetscCallA(PetscRandomDestroy(r,ierr))
21*f8402805SBarry Smith      PetscCallA(PetscFinalize(ierr))
22*f8402805SBarry Smith      end
23*f8402805SBarry Smith
24*f8402805SBarry Smith!
25*f8402805SBarry Smith!/*TEST
26*f8402805SBarry Smith!
27*f8402805SBarry Smith!   test:
28*f8402805SBarry Smith!      requires: !complex
29*f8402805SBarry Smith!
30*f8402805SBarry Smith!TEST*/
31