petsc-3.6.2 2015-10-02
Report Typos and Errors

# PetscRandomRegister

Adds a new PetscRandom component implementation

### Synopsis

    #include "petscsys.h"
    PetscErrorCode  PetscRandomRegister(const char sname[], PetscErrorCode (*function)(PetscRandom))

Not Collective

### Input Parameters

| name | - The name of a new user-defined creation routine
| create_func | - The creation routine itself

### Notes

PetscRandomRegister() may be called multiple times to add several user-defined randome number generators

### Sample usage

        PetscRandomRegister("my_rand",  MyPetscRandomtorCreate);

Then, your random type can be chosen with the procedural interface via

        PetscRandomCreate(MPI_Comm, PetscRandom *);
        PetscRandomSetType(PetscRandom,"my_random_name");

or at runtime via the option

        -random_type my_random_name

Notes: For an example of the code needed to interface your own random number generator see src/sys/random/impls/rand/rand.c

### Keywords

PetscRandom, register

### See Also

PetscRandomRegisterAll(), PetscRandomRegisterDestroy(), PetscRandomRegister()

Level:advanced
Location: src/sys/classes/random/interface/randreg.c
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages