randomEngine Constructors

Functions
randomEngine Constructors
Complete List of ArrayFire FunctionsComplete List of ArrayFire FunctionsComplete List of ArrayFire Functions ArrayFire Functions by Category » Functions to create and modify Arrays » | Functions to create arrays. » | Random Number Generation » | randomEngine

Create random number generator object. More...

## Functions
| randomEngine (randomEngineType typeIn=AF_RANDOM_ENGINE_DEFAULT, uintl seedIn=0)
| This function creates a af::randomEngine object with a af::randomEngineType and a seed. More...
| randomEngine (const randomEngine &in)
| Copy constructor for af::randomEngine. More...
| randomEngine (af_random_engine engine)
| Creates a copy of the random engine object from a af_random_engine handle. More...
AFAPI af_err | af_create_random_engine (af_random_engine *engine, af_random_engine_type rtype, uintl seed)
| C Interface for creating random engine. More...
AFAPI af_err | af_retain_random_engine (af_random_engine *out, const af_random_engine engine)
| C Interface for retaining random engine. More...

## Detailed Description

Create random number generator object.

A af::randomEngine object can be used to generate psuedo random numbers using various types of random number generation algorithms defined by af::randomEngineType.

## Function Documentation

## § af_create_random_engine()

AFAPI af_err af_create_random_engine | ( | af_random_engine * | engine,
|  | af_random_engine_type | rtype,
|  | uintl | seed
| ) |  |

C Interface for creating random engine.

Parameters

  [out] | engine | The pointer to the returned random engine object
  [in] | rtype | The type of the random number generator
  [in] | seed | The initializing seed of the random number generator

Returns
  AF_SUCCESS if the execution completes properly

## § af_retain_random_engine()

AFAPI af_err af_retain_random_engine | ( | af_random_engine * | out,
|  | const af_random_engine | engine
| ) |  |

C Interface for retaining random engine.

Parameters

  [out] | out | The pointer to the returned random engine object
  [in] | engine | The random engine object

Returns
  AF_SUCCESS if the execution completes properly

## § randomEngine() [1/3]

randomEngine | ( | randomEngineType | typeIn = `AF_RANDOM_ENGINE_DEFAULT`,
|  | uintl | seedIn = `0`
| ) |  |
| explicit

This function creates a af::randomEngine object with a af::randomEngineType and a seed.

randomEngine r(AF_RANDOM_ENGINE_DEFAULT, 1); // creates random engine of default type with seed = 1

## § randomEngine() [2/3]

randomEngine | ( | const randomEngine & | in | ) |

Copy constructor for af::randomEngine.

Parameters

  in | The input random engine object

## § randomEngine() [3/3]

randomEngine | ( | af_random_engine | engine | ) |

Creates a copy of the random engine object from a af_random_engine handle.

Parameters

  engine | The input random engine object