:orphan:
# PetscRandomSetType
Builds a context for generating a particular type of random numbers. 
## Synopsis
```
#include "petscsys.h" 
PetscErrorCode PetscRandomSetType(PetscRandom rnd, PetscRandomType type)
```
Collective


## Input Parameters

- ***rnd   -*** The random number generator context
- ***type -*** The name of the random type



## Options Database Key

- ***-random_type <type> -*** Sets the random type; use -help for a list
of available types





## Note
See `PetscRandomType` for available random types (for instance, `PETSCRAND48`, `PETSCRAND`).


## See Also
 `PetscRandom`, `PetscRandomType`, `PetscRandomGetType()`, `PetscRandomCreate()`

## Level
intermediate

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

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex7.c.html">src/snes/tutorials/ex7.c</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/classes/random/interface/randreg.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)  
