# PetscRandomGetValuesReal
Generates a sequence of real random numbers.  Call this after first calling `PetscRandomCreate()`. 
## Synopsis
```
#include "petscsys.h" 
PetscErrorCode PetscRandomGetValuesReal(PetscRandom r, PetscInt n, PetscReal *val)
```
Not Collective


## Input Parameters

- ***r  -*** the random number generator context
- ***n  -*** number of random numbers to generate



## Output Parameter

- ***val -*** the array to hold the values





## Note
Use `VecSetRandom()` to set the elements of a vector to random numbers.


## See Also
 `PetscRandom`, `PetscRandomCreate()`, `PetscRandomDestroy()`, `VecSetRandom()`, `PetscRandomGetValues()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/classes/random/interface/random.c.html#PetscRandomGetValuesReal">src/sys/classes/random/interface/random.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex21.c.html">src/ksp/ksp/tutorials/ex21.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex82.c.html">src/ksp/ksp/tutorials/ex82.c.html</A><BR>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/classes/random/impls/curand/curand.c.html#PetscRandomGetValuesReal_CURAND">PetscRandomGetValuesReal_CURAND in src/sys/classes/random/impls/curand/curand.c</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/classes/random/interface/random.c)


[Index of all Sys routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
