:orphan:
# PetscRandomDestroy
Destroys a context that has been formed by `PetscRandomCreate()`.
## Synopsis
```
#include "petscsys.h"
PetscErrorCode PetscRandomDestroy(PetscRandom *r)
```
Collective
## Input Parameter
- ***r -*** the random number generator context
## See Also
`PetscRandom`, `PetscRandomGetValue()`, `PetscRandomCreate()`, `VecSetRandom()`
## Level
intermediate
## Location
src/sys/classes/random/interface/randomc.c
## Examples
src/dm/field/tutorials/ex1.c
src/dm/tutorials/swarm_ex3.c
src/ksp/ksp/tutorials/ex11.c
src/ksp/ksp/tutorials/ex11f.F90
src/ksp/ksp/tutorials/ex18.c
src/ksp/ksp/tutorials/ex21.c
src/ksp/ksp/tutorials/ex2f.F90
src/ksp/ksp/tutorials/ex46.c
src/ksp/ksp/tutorials/ex5.c
src/ksp/ksp/tutorials/ex52.c
src/ksp/ksp/tutorials/ex57f.F90
## Implementations
PetscRandomDestroy_CURAND in src/sys/classes/random/impls/curand/curand.c
PetscRandomDestroy_Rander48 in src/sys/classes/random/impls/rander48/rander48.c
PetscRandomDestroy_Random123 in src/sys/classes/random/impls/random123/random123.c
---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/classes/random/interface/randomc.c)
[Index of all Sys routines](index.md)
[Table of Contents for all manual pages](/manualpages/index.md)
[Index of all manual pages](/manualpages/singleindex.md)