#include "petscsys.h" int PetscRandomCreate(MPI_Comm comm,PetscRandomType type,PetscRandom *r)Collective on MPI_Comm
comm | - MPI communicator | |
type | - the type of random numbers to be generated, usually RANDOM_DEFAULT |
Currently three types of random numbers are supported. These types are equivalent when working with real numbers.
Use VecSetRandom() to set the elements of a vector to random numbers.
PetscRandomCreate(PETSC_COMM_SELF,RANDOM_DEFAULT,&r); PetscRandomGetValue(r,&value1); PetscRandomGetValue(r,&value2); PetscRandomGetValue(r,&value3); PetscRandomDestroy(r);
Level:intermediate
Location:src/sys/src/utils/random.c
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages