VecSetRandom

Sets all components of a vector to random numbers.

Synopsis

int VecSetRandom(PetscRandom rctx,Vec x) 
Collective on Vec

Input Parameters

rctx - the random number context, formed by PetscRandomCreate()
x - the vector

Output Parameter

x -the vector

Example of Usage

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

Keywords

vector, set, random

See Also

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

Examples

src/sles/examples/tutorials/ex4.c
src/sles/examples/tutorials/ex2.c

Location: src/vec/interface/vector.c
Vector Index
Table of Contents