VecSetRandom

Sets all components of a vector to random numbers.

Synopsis

#include "petscvec.h" 
int VecSetRandom(PetscRandom rctx,Vec x) 
Collective on Vec

Input Parameters

rctx - the random number context, formed by PetscRandomCreate(), or PETSC_NULL and it will create one internally.
x - the vector

Output Parameter

x -the vector

Example of Usage

     PetscRandomCreate(PETSC_COMM_WORLD,RANDOM_DEFAULT,&rctx);
     VecSetRandom(rctx,x);
     PetscRandomDestroy(rctx);

See Also

VecSet(), VecSetValues(), PetscRandomCreate(), PetscRandomDestroy()

Level:intermediate
Location:
src/vec/interface/vector.c
Index of all Vec routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/sles/examples/tutorials/ex2.c.html
src/sles/examples/tutorials/ex4.c.html
src/sles/examples/tutorials/ex11.c.html
src/sles/examples/tutorials/ex2f.F.html
src/sles/examples/tutorials/ex11f.F.html