Skip to main content
`Ctrl`+`K`

# VecSetRandomNormal

Sets all components of a vector to normally distributed random values.

## Synopsis

    #include "slepcvec.h"
    PetscErrorCode VecSetRandomNormal(Vec v,PetscRandom rctx,Vec w1,Vec w2)

Logically Collective

## Input Parameters

- v - the vector to be filled with random values

- rctx - the random number context (can be `NULL`)

- w1 - first work vector (can be `NULL`)

- w2 - second work vector (can be `NULL`)

## Notes

Fills the two work vectors with uniformly distributed random values (`VecSetRandom()`) and then applies the Box-Muller transform to get normally distributed values on `v`.

## See Also

`VecSetRandom()`

## Level

developer

## Location

src/sys/vec/vecutil.c

Index of all Sys routines Table of Contents for all manual pages Index of all manual pages