petsc-3.14.6 2021-03-30
PetscRandomGetValueReal
Generates a purely real random number. Call this after first calling PetscRandomCreate().
Synopsis
#include "petscsys.h"
PetscErrorCode PetscRandomGetValueReal(PetscRandom r,PetscReal *val)
Not Collective
Intput Parameter
| r | - the random number generator context
|
Output Parameter
Notes
Use VecSetRandom() to set the elements of a vector to random numbers.
Example of Usage
PetscRandomCreate(PETSC_COMM_WORLD,&r);
PetscRandomGetValueReal(r,&value1);
PetscRandomGetValueReal(r,&value2);
PetscRandomGetValueReal(r,&value3);
PetscRandomDestroy(&r);
See Also
PetscRandomCreate(), PetscRandomDestroy(), VecSetRandom(), PetscRandomGetValue()
Level
intermediate
Location
src/sys/classes/random/interface/random.c
Examples
src/dm/tutorials/swarm_ex3.c.html
src/dm/field/tutorials/ex1.c.html
src/ksp/ksp/tutorials/ex21.c.html
src/ksp/ksp/tutorials/ex70.c.html
src/snes/tutorials/ex12.c.html
Implementations
PetscRandomGetValueReal_Rand in src/sys/classes/random/impls/rand/rand.c
PetscRandomGetValueReal_Rand48 in src/sys/classes/random/impls/rand48/rand48.c
PetscRandomGetValueReal_Rander48 in src/sys/classes/random/impls/rander48/rander48.c
PetscRandomGetValueReal_Random123 in src/sys/classes/random/impls/random123/random123.c
PetscRandomGetValueReal_Sprng in src/sys/classes/random/impls/sprng/sprng.c
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages