PetscRandomGetValue

Generates a random number. Call this after first calling PetscRandomCreate().

Synopsis

int PetscRandomGetValue(PetscRandom r,Scalar *val)
Not Collective

Intput Parameter

r -the random number generator context

Notes

Use VecSetRandom() to set the elements of a vector to random numbers.

Example of Usage

      PetscRandomCreate(PETSC_COMM_WORLD,RANDOM_DEFAULT,&r);
      PetscRandomGetValue(r,&value1);
      PetscRandomGetValue(r,&value2);
      PetscRandomGetValue(r,&value3);
      PetscRandomDestroy(r);

Keywords

random, get, value

See Also

PetscRandomCreate(), PetscRandomDestroy(), VecSetRandom()

Examples

src/sles/examples/tutorials/ex11f.F
src/sles/examples/tutorials/ex2f.F
src/sles/examples/tutorials/ex11.c

Location: src/sys/src/utilsrandom.c
System Index
Table of Contents