VecSetRandom

Sets all components of a vector to random numbers.

Synopsis

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

Input Parameters

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

Output Parameter

x - the vector

Example of Usage

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

Level: intermediate

See Also

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

Location:vector.c