#include "petscsys.h" PetscErrorCode PetscRandomGetValue(PetscRandom r,PetscScalar *val)Not Collective
When PETSc is compiled for complex numbers this returns a complex number with random real and complex parts. Use PetscGetValueReal() to get a random real number.
To get a complex number with only a random real part, first call PetscRandomSetInterval() with a equal low and high imaginary part. Similarly to get a complex number with only a random imaginary part call PetscRandomSetInterval() with a equal low and high real part.
PetscRandomCreate(PETSC_COMM_WORLD,&r); PetscRandomGetValue(r,&value1); PetscRandomGetValue(r,&value2); PetscRandomGetValue(r,&value3); PetscRandomDestroy(&r);
Level:intermediate
Location:src/sys/classes/random/interface/random.c
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages