| comm | - MPI communicator Many br |
Output Parameter
| r | - the random number generator context Many br |
Many br
Notes
The random type has to be set by PetscRandomSetType(). Many br
This is only a primative "parallel" random number generator, it should NOT Many brbe used for sophisticated parallel Monte Carlo methods since it will very likely Many brnot have the correct statistics across processors. You can provide your own Many brparallel generator using PetscRandomRegister(); Many br
If you create a PetscRandom() using PETSC_COMM_SELF on several processors then Many brthe SAME random numbers will be generated on all those processors. Use PETSC_COMM_WORLD Many bror the appropriate parallel communicator to eliminate this issue. Many br
Use VecSetRandom() to set the elements of a vector to random numbers. Many br
Example of Usage
PetscRandomCreate(PETSC_COMM_SELF,&r);
PetscRandomSetType(r,PETSCRAND48);
PetscRandomGetValue(r,&value1);
PetscRandomGetValueReal(r,&value2);
PetscRandomDestroy(&r);
Many br
See Also
PetscRandomSetType(), PetscRandomGetValue(), PetscRandomGetValueReal(), PetscRandomSetInterval(),
PetscRandomDestroy(), VecSetRandom(), PetscRandomType Many br
Level:intermediate
Location:src/sys/classes/random/interface/randomc.c
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages
Examples
src/sys/classes/random/examples/tutorials/ex1.c.html
src/sys/classes/random/examples/tutorials/ex2.c.html
src/ksp/ksp/examples/tutorials/ex2.c.html
src/ksp/ksp/examples/tutorials/ex11.c.html
src/ksp/ksp/examples/tutorials/ex18.c.html
src/ksp/ksp/examples/tutorials/ex46.c.html
src/ksp/ksp/examples/tutorials/ex52.c.html
src/ksp/ksp/examples/tutorials/ex2f.F.html
src/ksp/ksp/examples/tutorials/ex11f.F.html
src/ts/examples/tutorials/ex42.c.html
src/tao/unconstrained/examples/tutorials/minsurf2.c.html