C/C++ API Reference#

This chapter describes the rocRAND C and C++ API.

Device Functions#

group rocranddevice

Defines

ROCRAND_LFSR113_DEFAULT_SEED_X#

Default X seed for LFSR113 PRNG.

ROCRAND_LFSR113_DEFAULT_SEED_Y#

Default Y seed for LFSR113 PRNG.

ROCRAND_LFSR113_DEFAULT_SEED_Z#

Default Z seed for LFSR113 PRNG.

ROCRAND_LFSR113_DEFAULT_SEED_W#

Default W seed for LFSR113 PRNG.

ROCRAND_MRG31K3P_DEFAULT_SEED#

Default seed for MRG31K3P PRNG.

ROCRAND_MRG32K3A_DEFAULT_SEED#

Default seed for MRG32K3A PRNG.

ROCRAND_PHILOX4x32_DEFAULT_SEED#

Default seed for PHILOX4x32 PRNG.

FQUALIFIERS#

Shorthand for commonly used function qualifiers.

ROCRAND_XORWOW_DEFAULT_SEED#

Default seed for XORWOW PRNG.

Functions

FQUALIFIERS unsigned int rocrand_discrete (rocrand_state_philox4x32_10 *state, const rocrand_discrete_distribution discrete_distribution)

Returns a discrete distributed unsigned int value.

Returns a unsigned int distributed according to with discrete distribution discrete_distribution using Philox generator in state, and increments the position of the generator by one.

Parameters:
  • state – - Pointer to a state to use

  • discrete_distribution – - Related discrete distribution

Returns:

unsigned int value distributed according to discrete_distribution

FQUALIFIERS uint4 rocrand_discrete4 (rocrand_state_philox4x32_10 *state, const rocrand_discrete_distribution discrete_distribution)

Returns four discrete distributed unsigned int values.

Returns four unsigned int distributed according to with discrete distribution discrete_distribution using Philox generator in state, and increments the position of the generator by four.

Parameters:
  • state – - Pointer to a state to use

  • discrete_distribution – - Related discrete distribution

Returns:

Four unsigned int values distributed according to discrete_distribution as uint4

FQUALIFIERS unsigned int rocrand_discrete (rocrand_state_mrg31k3p *state, const rocrand_discrete_distribution discrete_distribution)

Returns a discrete distributed unsigned int value.

Returns a unsigned int distributed according to with discrete distribution discrete_distribution using MRG31k3p generator in state, and increments the position of the generator by one.

Parameters:
  • state – - Pointer to a state to use

  • discrete_distribution – - Related discrete distribution

Returns:

unsigned int value distributed according to discrete_distribution

FQUALIFIERS unsigned int rocrand_discrete (rocrand_state_mrg32k3a *state, const rocrand_discrete_distribution discrete_distribution)

Returns a discrete distributed unsigned int value.

Returns a unsigned int distributed according to with discrete distribution discrete_distribution using MRG32k3a generator in state, and increments the position of the generator by one.

Parameters:
  • state – - Pointer to a state to use

  • discrete_distribution – - Related discrete distribution

Returns:

unsigned int value distributed according to discrete_distribution

FQUALIFIERS unsigned int rocrand_discrete (rocrand_state_xorwow *state, const rocrand_discrete_distribution discrete_distribution)

Returns a discrete distributed unsigned int value.

Returns a unsigned int distributed according to with discrete distribution discrete_distribution using XORWOW generator in state, and increments the position of the generator by one.

Parameters:
  • state – - Pointer to a state to use

  • discrete_distribution – - Related discrete distribution

Returns:

unsigned int value distributed according to discrete_distribution

FQUALIFIERS unsigned int rocrand_discrete (rocrand_state_mtgp32 *state, const rocrand_discrete_distribution discrete_distribution)

Returns a discrete distributed unsigned int value.

Returns a unsigned int distributed according to with discrete distribution discrete_distribution using MTGP32 generator in state, and increments the position of the generator by one.

Parameters:
  • state – - Pointer to a state to use

  • discrete_distribution – - Related discrete distribution

Returns:

unsigned int value distributed according to discrete_distribution

FQUALIFIERS unsigned int rocrand_discrete (rocrand_state_sobol32 *state, const rocrand_discrete_distribution discrete_distribution)

Returns a discrete distributed unsigned int value.

Returns a unsigned int distributed according to with discrete distribution discrete_distribution using SOBOL32 generator in state, and increments the position of the generator by one.

Parameters:
  • state – - Pointer to a state to use

  • discrete_distribution – - Related discrete distribution

Returns:

unsigned int value distributed according to discrete_distribution

FQUALIFIERS unsigned int rocrand_discrete (rocrand_state_scrambled_sobol32 *state, const rocrand_discrete_distribution discrete_distribution)

Returns a discrete distributed unsigned int value.

Returns a unsigned int distributed according to discrete distribution discrete_distribution using SCRAMBLED_SOBOL32 generator in state, and increments the position of the generator by one.

Parameters:
  • state – - Pointer to a state to use

  • discrete_distribution – - Related discrete distribution

Returns:

unsigned int value distributed according to discrete_distribution

FQUALIFIERS unsigned int rocrand_discrete (rocrand_state_sobol64 *state, const rocrand_discrete_distribution discrete_distribution)

Returns a discrete distributed unsigned long long int value.

Returns a unsigned long long int distributed according to with discrete distribution discrete_distribution using SOBOL64 generator in state, and increments the position of the generator by one.

Parameters:
  • state – - Pointer to a state to use

  • discrete_distribution – - Related discrete distribution

Returns:

unsigned long long int value distributed according to discrete_distribution

FQUALIFIERS unsigned int rocrand_discrete (rocrand_state_scrambled_sobol64 *state, const rocrand_discrete_distribution discrete_distribution)

Returns a discrete distributed unsigned long long int value.

Returns a unsigned long long int distributed according to with discrete distribution discrete_distribution using SCRAMBLED_SOBOL64 generator in state, and increments the position of the generator by one.

Parameters:
  • state – - Pointer to a state to use

  • discrete_distribution – - Related discrete distribution

Returns:

unsigned long long int value distributed according to discrete_distribution

FQUALIFIERS unsigned int rocrand_discrete (rocrand_state_lfsr113 *state, const rocrand_discrete_distribution discrete_distribution)

Returns a discrete distributed unsigned int value.

Returns a unsigned int distributed according to with discrete distribution discrete_distribution using LFSR113 generator in state, and increments the position of the generator by one.

Parameters:
  • state – - Pointer to a state to use

  • discrete_distribution – - Related discrete distribution

Returns:

unsigned int value distributed according to discrete_distribution

FQUALIFIERS unsigned int rocrand_discrete (rocrand_state_threefry2x32_20 *state, const rocrand_discrete_distribution discrete_distribution)

Returns a discrete distributed unsigned int value.

Returns a unsigned int distributed according to with discrete distribution discrete_distribution using ThreeFry generator in state, and increments the position of the generator by one.

Parameters:
  • state – - Pointer to a state to use

  • discrete_distribution – - Related discrete distribution

Returns:

unsigned int value distributed according to discrete_distribution

FQUALIFIERS unsigned int rocrand_discrete (rocrand_state_threefry2x64_20 *state, const rocrand_discrete_distribution discrete_distribution)

Returns a discrete distributed unsigned int value.

Returns a unsigned int distributed according to with discrete distribution discrete_distribution using ThreeFry generator in state, and increments the position of the generator by one.

Parameters:
  • state – - Pointer to a state to use

  • discrete_distribution – - Related discrete distribution

Returns:

unsigned int value distributed according to discrete_distribution

FQUALIFIERS unsigned int rocrand_discrete (rocrand_state_threefry4x32_20 *state, const rocrand_discrete_distribution discrete_distribution)

Returns a discrete distributed unsigned int value.

Returns a unsigned int distributed according to with discrete distribution discrete_distribution using ThreeFry generator in state, and increments the position of the generator by one.

Parameters:
  • state – - Pointer to a state to use

  • discrete_distribution – - Related discrete distribution

Returns:

unsigned int value distributed according to discrete_distribution

FQUALIFIERS unsigned int rocrand_discrete (rocrand_state_threefry4x64_20 *state, const rocrand_discrete_distribution discrete_distribution)

Returns a discrete distributed unsigned int value.

Returns a unsigned int distributed according to with discrete distribution discrete_distribution using ThreeFry generator in state, and increments the position of the generator by one.

Parameters:
  • state – - Pointer to a state to use

  • discrete_distribution – - Related discrete distribution

Returns:

unsigned int value distributed according to discrete_distribution

FQUALIFIERS void rocrand_init (const uint4 seed, const unsigned int subsequence, rocrand_state_lfsr113 *state)

Initializes LFSR113 state.

Initializes the LFSR113 generator state with the given seed, subsequence, and offset.

Parameters:
  • seed – - Value to use as a seed

  • subsequence – - Subsequence to start at

  • state – - Pointer to state to initialize

FQUALIFIERS unsigned int rocrand (rocrand_state_lfsr113 *state)

Returns uniformly distributed random unsigned int value from [0; 2^32 - 1] range.

Generates and returns uniformly distributed random unsigned int value from [0; 2^32 - 1] range using LFSR113 generator in state. State is incremented by one position.

Parameters:

state – - Pointer to a state to use

Returns:

Pseudorandom value (32-bit) as an unsigned int

FQUALIFIERS float rocrand_log_normal (rocrand_state_philox4x32_10 *state, float mean, float stddev)

Returns a log-normally distributed float value.

Generates and returns a log-normally distributed float value using Philox generator in state, and increments position of the generator by one. The function uses the Box-Muller transform method to generate two normally distributed values, transforms them to log-normally distributed values, returns first of them, and saves the second to be returned on the next call.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Log-normally distributed float value

FQUALIFIERS float2 rocrand_log_normal2 (rocrand_state_philox4x32_10 *state, float mean, float stddev)

Returns two log-normally distributed float values.

Generates and returns two log-normally distributed float values using Philox generator in state, and increments position of the generator by two. The function uses the Box-Muller transform method to generate two normally distributed values, transforms them to log-normally distributed values, and returns both.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Two log-normally distributed float value as float2

FQUALIFIERS float4 rocrand_log_normal4 (rocrand_state_philox4x32_10 *state, float mean, float stddev)

Returns four log-normally distributed float values.

Generates and returns four log-normally distributed float values using Philox generator in state, and increments position of the generator by four. The function uses the Box-Muller transform method to generate four normally distributed values, transforms them to log-normally distributed values, and returns them.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Four log-normally distributed float value as float4

FQUALIFIERS double rocrand_log_normal_double (rocrand_state_philox4x32_10 *state, double mean, double stddev)

Returns a log-normally distributed double values.

Generates and returns a log-normally distributed double value using Philox generator in state, and increments position of the generator by two. The function uses the Box-Muller transform method to generate two normally distributed double values, transforms them to log-normally distributed double values, returns first of them, and saves the second to be returned on the next call.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Log-normally distributed double value

FQUALIFIERS double2 rocrand_log_normal_double2 (rocrand_state_philox4x32_10 *state, double mean, double stddev)

Returns two log-normally distributed double values.

Generates and returns two log-normally distributed double values using Philox generator in state, and increments position of the generator by four. The function uses the Box-Muller transform method to generate two normally distributed values, transforms them to log-normally distributed values, and returns both.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Two log-normally distributed double values as double2

FQUALIFIERS double4 rocrand_log_normal_double4 (rocrand_state_philox4x32_10 *state, double mean, double stddev)

Returns four log-normally distributed double values.

Generates and returns four log-normally distributed double values using Philox generator in state, and increments position of the generator by eight. The function uses the Box-Muller transform method to generate four normally distributed values, transforms them to log-normally distributed values, and returns them.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Four log-normally distributed double values as double4

FQUALIFIERS float rocrand_log_normal (rocrand_state_mrg31k3p *state, float mean, float stddev)

Returns a log-normally distributed float value.

Generates and returns a log-normally distributed float value using MRG31k3p generator in state, and increments position of the generator by one. The function uses the Box-Muller transform method to generate two normally distributed values, transforms them to log-normally distributed values, returns first of them, and saves the second to be returned on the next call.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Log-normally distributed float value

FQUALIFIERS float2 rocrand_log_normal2 (rocrand_state_mrg31k3p *state, float mean, float stddev)

Returns two log-normally distributed float values.

Generates and returns two log-normally distributed float values using MRG31k3p generator in state, and increments position of the generator by two. The function uses the Box-Muller transform method to generate two normally distributed values, transforms them to log-normally distributed values, and returns both.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Two log-normally distributed float value as float2

FQUALIFIERS double rocrand_log_normal_double (rocrand_state_mrg31k3p *state, double mean, double stddev)

Returns a log-normally distributed double value.

Generates and returns a log-normally distributed double value using MRG31k3p generator in state, and increments position of the generator by one. The function uses the Box-Muller transform method to generate two normally distributed double values, transforms them to log-normally distributed double values, returns first of them, and saves the second to be returned on the next call.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Log-normally distributed double value

FQUALIFIERS double2 rocrand_log_normal_double2 (rocrand_state_mrg31k3p *state, double mean, double stddev)

Returns two log-normally distributed double values.

Generates and returns two log-normally distributed double values using MRG31k3p generator in state, and increments position of the generator by two. The function uses the Box-Muller transform method to generate two normally distributed values, transforms them to log-normally distributed values, and returns both.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Two log-normally distributed double values as double2

FQUALIFIERS float rocrand_log_normal (rocrand_state_mrg32k3a *state, float mean, float stddev)

Returns a log-normally distributed float value.

Generates and returns a log-normally distributed float value using MRG32k3a generator in state, and increments position of the generator by one. The function uses the Box-Muller transform method to generate two normally distributed values, transforms them to log-normally distributed values, returns first of them, and saves the second to be returned on the next call.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Log-normally distributed float value

FQUALIFIERS float2 rocrand_log_normal2 (rocrand_state_mrg32k3a *state, float mean, float stddev)

Returns two log-normally distributed float values.

Generates and returns two log-normally distributed float values using MRG32k3a generator in state, and increments position of the generator by two. The function uses the Box-Muller transform method to generate two normally distributed values, transforms them to log-normally distributed values, and returns both.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Two log-normally distributed float value as float2

FQUALIFIERS double rocrand_log_normal_double (rocrand_state_mrg32k3a *state, double mean, double stddev)

Returns a log-normally distributed double value.

Generates and returns a log-normally distributed double value using MRG32k3a generator in state, and increments position of the generator by one. The function uses the Box-Muller transform method to generate two normally distributed double values, transforms them to log-normally distributed double values, returns first of them, and saves the second to be returned on the next call.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Log-normally distributed double value

FQUALIFIERS double2 rocrand_log_normal_double2 (rocrand_state_mrg32k3a *state, double mean, double stddev)

Returns two log-normally distributed double values.

Generates and returns two log-normally distributed double values using MRG32k3a generator in state, and increments position of the generator by two. The function uses the Box-Muller transform method to generate two normally distributed values, transforms them to log-normally distributed values, and returns both.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Two log-normally distributed double values as double2

FQUALIFIERS float rocrand_log_normal (rocrand_state_xorwow *state, float mean, float stddev)

Returns a log-normally distributed float value.

Generates and returns a log-normally distributed float value using XORWOW generator in state, and increments position of the generator by one. The function uses the Box-Muller transform method to generate two normally distributed values, transforms them to log-normally distributed values, returns first of them, and saves the second to be returned on the next call.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Log-normally distributed float value

FQUALIFIERS float2 rocrand_log_normal2 (rocrand_state_xorwow *state, float mean, float stddev)

Returns two log-normally distributed float values.

Generates and returns two log-normally distributed float values using XORWOW generator in state, and increments position of the generator by two. The function uses the Box-Muller transform method to generate two normally distributed values, transforms them to log-normally distributed values, and returns both.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Two log-normally distributed float value as float2

FQUALIFIERS double rocrand_log_normal_double (rocrand_state_xorwow *state, double mean, double stddev)

Returns a log-normally distributed double value.

Generates and returns a log-normally distributed double value using XORWOW generator in state, and increments position of the generator by two. The function uses the Box-Muller transform method to generate two normally distributed double values, transforms them to log-normally distributed double values, returns first of them, and saves the second to be returned on the next call.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Log-normally distributed double value

FQUALIFIERS double2 rocrand_log_normal_double2 (rocrand_state_xorwow *state, double mean, double stddev)

Returns two log-normally distributed double values.

Generates and returns two log-normally distributed double values using XORWOW generator in state, and increments position of the generator by four. The function uses the Box-Muller transform method to generate two normally distributed values, transforms them to log-normally distributed values, and returns both.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Two log-normally distributed double values as double2

FQUALIFIERS float rocrand_log_normal (rocrand_state_mtgp32 *state, float mean, float stddev)

Returns a log-normally distributed float value.

Generates and returns a log-normally distributed float value using MTGP32 generator in state, and increments position of the generator by one.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Log-normally distributed float value

FQUALIFIERS double rocrand_log_normal_double (rocrand_state_mtgp32 *state, double mean, double stddev)

Returns a log-normally distributed double value.

Generates and returns a log-normally distributed double value using MTGP32 generator in state, and increments position of the generator by one.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Log-normally distributed double value

FQUALIFIERS float rocrand_log_normal (rocrand_state_sobol32 *state, float mean, float stddev)

Returns a log-normally distributed float value.

Generates and returns a log-normally distributed float value using SOBOL32 generator in state, and increments position of the generator by one.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Log-normally distributed float value

FQUALIFIERS double rocrand_log_normal_double (rocrand_state_sobol32 *state, double mean, double stddev)

Returns a log-normally distributed double value.

Generates and returns a log-normally distributed double value using SOBOL32 generator in state, and increments position of the generator by one.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Log-normally distributed double value

FQUALIFIERS float rocrand_log_normal (rocrand_state_scrambled_sobol32 *state, float mean, float stddev)

Returns a log-normally distributed float value.

Generates and returns a log-normally distributed float value using SCRAMBLED_SOBOL32 generator in state, and increments position of the generator by one.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Log-normally distributed float value

FQUALIFIERS double rocrand_log_normal_double (rocrand_state_scrambled_sobol32 *state, double mean, double stddev)

Returns a log-normally distributed double value.

Generates and returns a log-normally distributed double value using SCRAMBLED_SOBOL32 generator in state, and increments position of the generator by one.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Log-normally distributed double value

FQUALIFIERS float rocrand_log_normal (rocrand_state_sobol64 *state, float mean, float stddev)

Returns a log-normally distributed float value.

Generates and returns a log-normally distributed float value using SOBOL64 generator in state, and increments position of the generator by one.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Log-normally distributed float value

FQUALIFIERS double rocrand_log_normal_double (rocrand_state_sobol64 *state, double mean, double stddev)

Returns a log-normally distributed double value.

Generates and returns a log-normally distributed double value using SOBOL64 generator in state, and increments position of the generator by one.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Log-normally distributed double value

FQUALIFIERS float rocrand_log_normal (rocrand_state_scrambled_sobol64 *state, float mean, float stddev)

Returns a log-normally distributed float value.

Generates and returns a log-normally distributed float value using SCRAMBLED_SOBOL64 generator in state, and increments position of the generator by one.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Log-normally distributed float value

FQUALIFIERS double rocrand_log_normal_double (rocrand_state_scrambled_sobol64 *state, double mean, double stddev)

Returns a log-normally distributed double value.

Generates and returns a log-normally distributed double value using SCRAMBLED_SOBOL64 generator in state, and increments position of the generator by one.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Log-normally distributed double value

FQUALIFIERS float rocrand_log_normal (rocrand_state_lfsr113 *state, float mean, float stddev)

Returns a log-normally distributed float value.

Generates and returns a log-normally distributed float value using LFSR113 generator in state, and increments position of the generator by one.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Log-normally distributed float value

FQUALIFIERS float2 rocrand_log_normal2 (rocrand_state_lfsr113 *state, float mean, float stddev)

Returns two log-normally distributed float values.

Generates and returns two log-normally distributed float values using LFSR113 generator in state, and increments position of the generator by two. The function uses the Box-Muller transform method to generate two normally distributed values, transforms them to log-normally distributed values, and returns both.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Two log-normally distributed float value as float2

FQUALIFIERS double rocrand_log_normal_double (rocrand_state_lfsr113 *state, double mean, double stddev)

Returns a log-normally distributed double value.

Generates and returns a log-normally distributed double value using LFSR113 generator in state, and increments position of the generator by one.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Log-normally distributed double value

FQUALIFIERS double2 rocrand_log_normal_double2 (rocrand_state_lfsr113 *state, double mean, double stddev)

Returns two log-normally distributed double values.

Generates and returns two log-normally distributed double values using LFSR113 generator in state, and increments position of the generator by two. The function uses the Box-Muller transform method to generate two normally distributed values, transforms them to log-normally distributed values, and returns both.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Two log-normally distributed double values as double2

FQUALIFIERS float rocrand_log_normal (rocrand_state_threefry2x32_20 *state, double mean, double stddev)

Returns a log-normally distributed float value.

Generates and returns a log-normally distributed float value using ThreeFry generator in state, and increments position of the generator by one.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Log-normally distributed float value

FQUALIFIERS float2 rocrand_log_normal2 (rocrand_state_threefry2x32_20 *state, float mean, float stddev)

Returns two log-normally distributed float values.

Generates and returns two log-normally distributed float values using Threefry generator in state, and increments position of the generator by two. The function uses the Box-Muller transform method to generate two normally distributed values, transforms them to log-normally distributed values, and returns both.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Two log-normally distributed float value as float2

FQUALIFIERS double rocrand_log_normal_double (rocrand_state_threefry2x32_20 *state, double mean, double stddev)

Returns a log-normally distributed double value.

Generates and returns a log-normally distributed double value using ThreeFry generator in state, and increments position of the generator by one.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Log-normally distributed double value

FQUALIFIERS double2 rocrand_log_normal_double2 (rocrand_state_threefry2x32_20 *state, double mean, double stddev)

Returns two log-normally distributed double values.

Generates and returns two log-normally distributed double values using Threefry generator in state, and increments position of the generator by two. The function uses the Box-Muller transform method to generate two normally distributed values, transforms them to log-normally distributed values, and returns both.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Two log-normally distributed double values as double2

FQUALIFIERS float rocrand_log_normal (rocrand_state_threefry2x64_20 *state, double mean, double stddev)

Returns a log-normally distributed float value.

Generates and returns a log-normally distributed float value using ThreeFry generator in state, and increments position of the generator by one.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Log-normally distributed float value

FQUALIFIERS float2 rocrand_log_normal2 (rocrand_state_threefry2x64_20 *state, float mean, float stddev)

Returns two log-normally distributed float values.

Generates and returns two log-normally distributed float values using Threefry generator in state, and increments position of the generator by two. The function uses the Box-Muller transform method to generate two normally distributed values, transforms them to log-normally distributed values, and returns both.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Two log-normally distributed float value as float2

FQUALIFIERS double rocrand_log_normal_double (rocrand_state_threefry2x64_20 *state, double mean, double stddev)

Returns a log-normally distributed double value.

Generates and returns a log-normally distributed double value using ThreeFry generator in state, and increments position of the generator by one.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Log-normally distributed double value

FQUALIFIERS double2 rocrand_log_normal_double2 (rocrand_state_threefry2x64_20 *state, double mean, double stddev)

Returns two log-normally distributed double values.

Generates and returns two log-normally distributed double values using Threefry generator in state, and increments position of the generator by two. The function uses the Box-Muller transform method to generate two normally distributed values, transforms them to log-normally distributed values, and returns both.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Two log-normally distributed double values as double2

FQUALIFIERS float rocrand_log_normal (rocrand_state_threefry4x32_20 *state, double mean, double stddev)

Returns a log-normally distributed float value.

Generates and returns a log-normally distributed float value using ThreeFry generator in state, and increments position of the generator by one.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Log-normally distributed float value

FQUALIFIERS float2 rocrand_log_normal2 (rocrand_state_threefry4x32_20 *state, float mean, float stddev)

Returns two log-normally distributed float values.

Generates and returns two log-normally distributed float values using THREEFRY generator in state, and increments position of the generator by two. The function uses the Box-Muller transform method to generate two normally distributed values, transforms them to log-normally distributed values, and returns both.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Two log-normally distributed float value as float2

FQUALIFIERS double rocrand_log_normal_double (rocrand_state_threefry4x32_20 *state, double mean, double stddev)

Returns a log-normally distributed double value.

Generates and returns a log-normally distributed double value using ThreeFry generator in state, and increments position of the generator by one.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Log-normally distributed double value

FQUALIFIERS double2 rocrand_log_normal_double2 (rocrand_state_threefry4x32_20 *state, double mean, double stddev)

Returns two log-normally distributed double values.

Generates and returns two log-normally distributed double values using Threefry generator in state, and increments position of the generator by two. The function uses the Box-Muller transform method to generate two normally distributed values, transforms them to log-normally distributed values, and returns both.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Two log-normally distributed double values as double2

FQUALIFIERS float rocrand_log_normal (rocrand_state_threefry4x64_20 *state, double mean, double stddev)

Returns a log-normally distributed float value.

Generates and returns a log-normally distributed float value using ThreeFry generator in state, and increments position of the generator by one.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Log-normally distributed float value

FQUALIFIERS float2 rocrand_log_normal2 (rocrand_state_threefry4x64_20 *state, float mean, float stddev)

Returns two log-normally distributed float values.

Generates and returns two log-normally distributed float values using Threefry generator in state, and increments position of the generator by two. The function uses the Box-Muller transform method to generate two normally distributed values, transforms them to log-normally distributed values, and returns both.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Two log-normally distributed float value as float2

FQUALIFIERS double rocrand_log_normal_double (rocrand_state_threefry4x64_20 *state, double mean, double stddev)

Returns a log-normally distributed double value.

Generates and returns a log-normally distributed double value using ThreeFry generator in state, and increments position of the generator by one.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Log-normally distributed double value

FQUALIFIERS double2 rocrand_log_normal_double2 (rocrand_state_threefry4x64_20 *state, double mean, double stddev)

Returns two log-normally distributed double values.

Generates and returns two log-normally distributed double values using Threefry generator in state, and increments position of the generator by two. The function uses the Box-Muller transform method to generate two normally distributed values, transforms them to log-normally distributed values, and returns both.

Parameters:
  • state – - Pointer to a state to use

  • mean – - Mean of the related log-normal distribution

  • stddev – - Standard deviation of the related log-normal distribution

Returns:

Two log-normally distributed double values as double2

FQUALIFIERS void rocrand_init (const unsigned long long seed, const unsigned long long subsequence, const unsigned long long offset, rocrand_state_mrg31k3p *state)

Initializes MRG31K3P state.

Initializes the MRG31K3P generator state with the given seed, subsequence, and offset.

Parameters:
  • seed – - Value to use as a seed

  • subsequence – - Subsequence to start at

  • offset – - Absolute offset into subsequence

  • state – - Pointer to state to initialize

FQUALIFIERS unsigned int rocrand (rocrand_state_mrg31k3p *state)

Returns uniformly distributed random unsigned int value from [0; 2^32 - 1] range.

Generates and returns uniformly distributed random unsigned int value from [0; 2^32 - 1] range using MRG31K3P generator in state. State is incremented by one position.

Parameters:

state – - Pointer to a state to use

Returns:

Pseudorandom value (32-bit) as an unsigned int

FQUALIFIERS void skipahead (unsigned long long offset, rocrand_state_mrg31k3p *state)

Updates MRG31K3P state to skip ahead by offset elements.

Updates the MRG31K3P state in state to skip ahead by offset elements.

Parameters:
  • offset – - Number of elements to skip

  • state – - Pointer to state to update

FQUALIFIERS void skipahead_subsequence (unsigned long long subsequence, rocrand_state_mrg31k3p *state)

Updates MRG31K3P state to skip ahead by subsequence subsequences.

Updates the MRG31K3P state in state to skip ahead by subsequence subsequences. Each subsequence is 2^72 numbers long.

Parameters:
  • subsequence – - Number of subsequences to skip

  • state – - Pointer to state to update

FQUALIFIERS void skipahead_sequence (unsigned long long sequence, rocrand_state_mrg31k3p *state)

Updates MRG31K3P state to skip ahead by sequence sequences.

Updates the MRG31K3P state in state to skip ahead by sequence sequences. Each sequence is 2^134 numbers long.

Parameters:
  • sequence – - Number of sequences to skip

  • state – - Pointer to state to update

FQUALIFIERS void rocrand_init (const unsigned long long seed, const unsigned long long subsequence, const unsigned long long offset, rocrand_state_mrg32k3a *state)

Initializes MRG32K3A state.

Initializes the MRG32K3A generator state with the given seed, subsequence, and offset.

Parameters:
  • seed – - Value to use as a seed

  • subsequence – - Subsequence to start at

  • offset – - Absolute offset into subsequence

  • state – - Pointer to state to initialize

FQUALIFIERS unsigned int rocrand (rocrand_state_mrg32k3a *state)

Returns uniformly distributed random unsigned int value from [0; 2^32 - 1] range.

Generates and returns uniformly distributed random unsigned int value from [0; 2^32 - 1] range using MRG32K3A generator in state. State is incremented by one position.

Parameters:

state – - Pointer to a state to use

Returns:

Pseudorandom value (32-bit) as an unsigned int

FQUALIFIERS void skipahead (unsigned long long offset, rocrand_state_mrg32k3a *state)

Updates MRG32K3A state to skip ahead by offset elements.

Updates the MRG32K3A state in state to skip ahead by offset elements.

Parameters:
  • offset – - Number of elements to skip

  • state – - Pointer to state to update

FQUALIFIERS void skipahead_subsequence (unsigned long long subsequence, rocrand_state_mrg32k3a *state)

Updates MRG32K3A state to skip ahead by subsequence subsequences.

Updates the MRG32K3A state in state to skip ahead by subsequence subsequences. Each subsequence is 2^76 numbers long.

Parameters:
  • subsequence – - Number of subsequences to skip

  • state – - Pointer to state to update

FQUALIFIERS void skipahead_sequence (unsigned long long sequence, rocrand_state_mrg32k3a *state)

Updates MRG32K3A state to skip ahead by sequence sequences.

Updates the MRG32K3A state in state to skip ahead by sequence sequences. Each sequence is 2^127 numbers long.

Parameters:
  • sequence – - Number of sequences to skip

  • state – - Pointer to state to update

inline __host__ rocrand_status rocrand_make_state_mtgp32 (rocrand_state_mtgp32 *d_state, mtgp32_fast_params params[], int n, unsigned long long seed)

Initializes MTGP32 states.

Initializes MTGP32 states on the host-side by allocating a state array in host memory, initializes that array, and copies the result to device memory.

Parameters:
  • d_state – - Pointer to an array of states in device memory

  • params – - Pointer to an array of type mtgp32_fast_params in host memory

  • n – - Number of states to initialize

  • seed – - Seed value

Returns:

  • ROCRAND_STATUS_ALLOCATION_FAILED if states could not be initialized

  • ROCRAND_STATUS_SUCCESS if states are initialized

inline __host__ rocrand_status rocrand_make_constant (const mtgp32_fast_params params[], mtgp32_params *p)

Loads parameters for MTGP32.

Loads parameters for use by kernel functions on the host-side and copies the results to the specified location in device memory.

NOTE: Not used as rocrand_make_state_mtgp32 handles loading parameters into state.

Parameters:
  • params – - Pointer to an array of type mtgp32_fast_params in host memory

  • p – - Pointer to a mtgp32_params structure allocated in device memory

Returns:

  • ROCRAND_STATUS_ALLOCATION_FAILED if parameters could not be loaded

  • ROCRAND_STATUS_SUCCESS if parameters are loaded

FQUALIFIERS unsigned int rocrand (rocrand_state_mtgp32 *state)

Returns uniformly distributed random unsigned int value from [0; 2^32 - 1] range.

Generates and returns uniformly distributed random unsigned int value from [0; 2^32 - 1] range using MTGP32 generator in state. State is incremented by one position.

Parameters:

state – - Pointer to a state to use

Returns:

Pseudorandom value (32-bit) as an unsigned int

FQUALIFIERS void rocrand_mtgp32_block_copy (rocrand_state_mtgp32 *src, rocrand_state_mtgp32 *dest)

Copies MTGP32 state to another state using block of threads.

Copies a MTGP32 state src to dest using a block of threads efficiently. Example usage would be:

__global__
void generate_kernel(rocrand_state_mtgp32 * states, unsigned int * output, const size_t size)
{
     const unsigned int state_id = blockIdx.x;
     unsigned int index = blockIdx.x * blockDim.x + threadIdx.x;
     unsigned int stride = gridDim.x * blockDim.x;

     __shared__ GeneratorState state;
     rocrand_mtgp32_block_copy(&states[state_id], &state);

     while(index < size)
     {
         output[index] = rocrand(&state);
         index += stride;
     }

     rocrand_mtgp32_block_copy(&state, &states[state_id]);
}
Parameters:
  • src – - Pointer to a state to copy from

  • dest – - Pointer to a state to copy to

FQUALIFIERS void rocrand_mtgp32_set_params (rocrand_state_mtgp32 *state, mtgp32_params *params)

Changes parameters of a MTGP32 state.

Parameters:
  • state – - Pointer to a MTGP32 state

  • params – - Pointer to new parameters

FQUALIFIERS float rocrand_normal (rocrand_state_philox4x32_10 *state)

Returns a normally distributed float value.

Generates and returns a normally distributed float value using Philox generator in state, and increments position of the generator by one. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f. The function uses the Box-Muller transform method to generate two normally distributed values, returns first of them, and saves the second to be returned on the next call.

Parameters:

state – - Pointer to a state to use

Returns:

Normally distributed float value

FQUALIFIERS float2 rocrand_normal2 (rocrand_state_philox4x32_10 *state)

Returns two normally distributed float values.

Generates and returns two normally distributed float values using Philox generator in state, and increments position of the generator by two. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f. The function uses the Box-Muller transform method to generate two normally distributed values, and returns both of them.

Parameters:

state – - Pointer to a state to use

Returns:

Two normally distributed float value as float2

FQUALIFIERS float4 rocrand_normal4 (rocrand_state_philox4x32_10 *state)

Returns four normally distributed float values.

Generates and returns four normally distributed float values using Philox generator in state, and increments position of the generator by four. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f. The function uses the Box-Muller transform method to generate four normally distributed values, and returns them.

Parameters:

state – - Pointer to a state to use

Returns:

Four normally distributed float value as float4

FQUALIFIERS double rocrand_normal_double (rocrand_state_philox4x32_10 *state)

Returns a normally distributed double value.

Generates and returns a normally distributed double value using Philox generator in state, and increments position of the generator by two. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f. The function uses the Box-Muller transform method to generate two normally distributed values, returns first of them, and saves the second to be returned on the next call.

Parameters:

state – - Pointer to a state to use

Returns:

Normally distributed double value

FQUALIFIERS double2 rocrand_normal_double2 (rocrand_state_philox4x32_10 *state)

Returns two normally distributed double values.

Generates and returns two normally distributed double values using Philox generator in state, and increments position of the generator by four. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f. The function uses the Box-Muller transform method to generate two normally distributed values, and returns both of them.

Parameters:

state – - Pointer to a state to use

Returns:

Two normally distributed double values as double2

FQUALIFIERS double4 rocrand_normal_double4 (rocrand_state_philox4x32_10 *state)

Returns four normally distributed double values.

Generates and returns four normally distributed double values using Philox generator in state, and increments position of the generator by eight. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f. The function uses the Box-Muller transform method to generate four normally distributed values, and returns them.

Parameters:

state – - Pointer to a state to use

Returns:

Four normally distributed double values as double4

FQUALIFIERS float rocrand_normal (rocrand_state_mrg31k3p *state)

Returns a normally distributed float value.

Generates and returns a normally distributed float value using MRG31k3p generator in state, and increments position of the generator by one. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f. The function uses the Box-Muller transform method to generate two normally distributed values, returns first of them, and saves the second to be returned on the next call.

Parameters:

state – - Pointer to a state to use

Returns:

Normally distributed float value

FQUALIFIERS float2 rocrand_normal2 (rocrand_state_mrg31k3p *state)

Returns two normally distributed float values.

Generates and returns two normally distributed float values using MRG31k3p generator in state, and increments position of the generator by two. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f. The function uses the Box-Muller transform method to generate two normally distributed values, and returns both of them.

Parameters:

state – - Pointer to a state to use

Returns:

Two normally distributed float value as float2

FQUALIFIERS double rocrand_normal_double (rocrand_state_mrg31k3p *state)

Returns a normally distributed double value.

Generates and returns a normally distributed double value using MRG31k3p generator in state, and increments position of the generator by one. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f. The function uses the Box-Muller transform method to generate two normally distributed values, returns first of them, and saves the second to be returned on the next call.

Parameters:

state – - Pointer to a state to use

Returns:

Normally distributed double value

FQUALIFIERS double2 rocrand_normal_double2 (rocrand_state_mrg31k3p *state)

Returns two normally distributed double values.

Generates and returns two normally distributed double values using MRG31k3p generator in state, and increments position of the generator by two. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f. The function uses the Box-Muller transform method to generate two normally distributed values, and returns both of them.

Parameters:

state – - Pointer to a state to use

Returns:

Two normally distributed double value as double2

FQUALIFIERS float rocrand_normal (rocrand_state_mrg32k3a *state)

Returns a normally distributed float value.

Generates and returns a normally distributed float value using MRG32k3a generator in state, and increments position of the generator by one. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f. The function uses the Box-Muller transform method to generate two normally distributed values, returns first of them, and saves the second to be returned on the next call.

Parameters:

state – - Pointer to a state to use

Returns:

Normally distributed float value

FQUALIFIERS float2 rocrand_normal2 (rocrand_state_mrg32k3a *state)

Returns two normally distributed float values.

Generates and returns two normally distributed float values using MRG32k3a generator in state, and increments position of the generator by two. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f. The function uses the Box-Muller transform method to generate two normally distributed values, and returns both of them.

Parameters:

state – - Pointer to a state to use

Returns:

Two normally distributed float value as float2

FQUALIFIERS double rocrand_normal_double (rocrand_state_mrg32k3a *state)

Returns a normally distributed double value.

Generates and returns a normally distributed double value using MRG32k3a generator in state, and increments position of the generator by one. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f. The function uses the Box-Muller transform method to generate two normally distributed values, returns first of them, and saves the second to be returned on the next call.

Parameters:

state – - Pointer to a state to use

Returns:

Normally distributed double value

FQUALIFIERS double2 rocrand_normal_double2 (rocrand_state_mrg32k3a *state)

Returns two normally distributed double values.

Generates and returns two normally distributed double values using MRG32k3a generator in state, and increments position of the generator by two. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f. The function uses the Box-Muller transform method to generate two normally distributed values, and returns both of them.

Parameters:

state – - Pointer to a state to use

Returns:

Two normally distributed double value as double2

FQUALIFIERS float rocrand_normal (rocrand_state_xorwow *state)

Returns a normally distributed float value.

Generates and returns a normally distributed float value using XORWOW generator in state, and increments position of the generator by one. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f. The function uses the Box-Muller transform method to generate two normally distributed values, returns first of them, and saves the second to be returned on the next call.

Parameters:

state – - Pointer to a state to use

Returns:

Normally distributed float value

FQUALIFIERS float2 rocrand_normal2 (rocrand_state_xorwow *state)

Returns two normally distributed float values.

Generates and returns two normally distributed float values using XORWOW generator in state, and increments position of the generator by two. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f. The function uses the Box-Muller transform method to generate two normally distributed values, and returns both of them.

Parameters:

state – - Pointer to a state to use

Returns:

Two normally distributed float values as float2

FQUALIFIERS double rocrand_normal_double (rocrand_state_xorwow *state)

Returns a normally distributed double value.

Generates and returns a normally distributed double value using XORWOW generator in state, and increments position of the generator by two. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f. The function uses the Box-Muller transform method to generate two normally distributed values, returns first of them, and saves the second to be returned on the next call.

Parameters:

state – - Pointer to a state to use

Returns:

Normally distributed double value

FQUALIFIERS double2 rocrand_normal_double2 (rocrand_state_xorwow *state)

Returns two normally distributed double values.

Generates and returns two normally distributed double values using XORWOW generator in state, and increments position of the generator by four. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f. The function uses the Box-Muller transform method to generate two normally distributed values, and returns both of them.

Parameters:

state – - Pointer to a state to use

Returns:

Two normally distributed double value as double2

FQUALIFIERS float rocrand_normal (rocrand_state_mtgp32 *state)

Returns a normally distributed float value.

Generates and returns a normally distributed float value using MTGP32 generator in state, and increments position of the generator by one. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f.

Parameters:

state – - Pointer to a state to use

Returns:

Normally distributed float value

FQUALIFIERS double rocrand_normal_double (rocrand_state_mtgp32 *state)

Returns a normally distributed double value.

Generates and returns a normally distributed double value using MTGP32 generator in state, and increments position of the generator by one. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f.

Parameters:

state – - Pointer to a state to use

Returns:

Normally distributed double value

FQUALIFIERS float rocrand_normal (rocrand_state_sobol32 *state)

Returns a normally distributed float value.

Generates and returns a normally distributed float value using SOBOL32 generator in state, and increments position of the generator by one. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f.

Parameters:

state – - Pointer to a state to use

Returns:

Normally distributed float value

FQUALIFIERS double rocrand_normal_double (rocrand_state_sobol32 *state)

Returns a normally distributed double value.

Generates and returns a normally distributed double value using SOBOL32 generator in state, and increments position of the generator by one. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f.

Parameters:

state – - Pointer to a state to use

Returns:

Normally distributed double value

FQUALIFIERS float rocrand_normal (rocrand_state_scrambled_sobol32 *state)

Returns a normally distributed float value.

Generates and returns a normally distributed float value using SCRAMBLED_SOBOL32 generator in state, and increments position of the generator by one. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f.

Parameters:

state – - Pointer to a state to use

Returns:

Normally distributed float value

FQUALIFIERS double rocrand_normal_double (rocrand_state_scrambled_sobol32 *state)

Returns a normally distributed double value.

Generates and returns a normally distributed double value using SCRAMBLED_SOBOL32 generator in state, and increments position of the generator by one. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f.

Parameters:

state – - Pointer to a state to use

Returns:

Normally distributed double value

FQUALIFIERS float rocrand_normal (rocrand_state_sobol64 *state)

Returns a normally distributed float value.

Generates and returns a normally distributed float value using SOBOL64 generator in state, and increments position of the generator by one. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f.

Parameters:

state – - Pointer to a state to use

Returns:

Normally distributed float value

FQUALIFIERS double rocrand_normal_double (rocrand_state_sobol64 *state)

Returns a normally distributed double value.

Generates and returns a normally distributed double value using SOBOL64 generator in state, and increments position of the generator by one. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f.

Parameters:

state – - Pointer to a state to use

Returns:

Normally distributed double value

FQUALIFIERS float rocrand_normal (rocrand_state_scrambled_sobol64 *state)

Returns a normally distributed float value.

Generates and returns a normally distributed float value using SCRAMBLED_SOBOL64 generator in state, and increments position of the generator by one. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f.

Parameters:

state – - Pointer to a state to use

Returns:

Normally distributed float value

FQUALIFIERS double rocrand_normal_double (rocrand_state_scrambled_sobol64 *state)

Returns a normally distributed double value.

Generates and returns a normally distributed double value using SCRAMBLED_SOBOL64 generator in state, and increments position of the generator by one. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f.

Parameters:

state – - Pointer to a state to use

Returns:

Normally distributed double value

FQUALIFIERS float rocrand_normal (rocrand_state_lfsr113 *state)

Returns a normally distributed float value.

Generates and returns a normally distributed float value using LFSR113 generator in state, and increments position of the generator by one. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f.

Parameters:

state – - Pointer to a state to use

Returns:

Normally distributed float value

FQUALIFIERS float2 rocrand_normal2 (rocrand_state_lfsr113 *state)

Returns two normally distributed float values.

Generates and returns two normally distributed float values using LFSR113 generator in state, and increments position of the generator by two. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f. The function uses the Box-Muller transform method to generate two normally distributed values, and returns both of them.

Parameters:

state – - Pointer to a state to use

Returns:

Two normally distributed float value as float2

FQUALIFIERS double rocrand_normal_double (rocrand_state_lfsr113 *state)

Returns a normally distributed double value.

Generates and returns a normally distributed double value using LFSR113 generator in state, and increments position of the generator by one. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f.

Parameters:

state – - Pointer to a state to use

Returns:

Normally distributed double value

FQUALIFIERS double2 rocrand_normal_double2 (rocrand_state_lfsr113 *state)

Returns two normally distributed double values.

Generates and returns two normally distributed double values using LFSR113 generator in state, and increments position of the generator by two. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f. The function uses the Box-Muller transform method to generate two normally distributed values, and returns both of them.

Parameters:

state – - Pointer to a state to use

Returns:

Two normally distributed double value as double2

FQUALIFIERS float rocrand_normal (rocrand_state_threefry2x32_20 *state)

Returns a normally distributed double value.

Generates and returns a normally distributed float value using ThreeFry generator in state, and increments position of the generator by one. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f.

Parameters:

state – - Pointer to a state to use

Returns:

Normally distributed float value

FQUALIFIERS float2 rocrand_normal2 (rocrand_state_threefry2x32_20 *state)

Returns two normally distributed float values.

Generates and returns two normally distributed float values using ThreeFry generator in state, and increments position of the generator by two. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f. The function uses the Box-Muller transform method to generate two normally distributed values, and returns both of them.

Parameters:

state – - Pointer to a state to use

Returns:

Two normally distributed float value as float2

FQUALIFIERS double rocrand_normal_double (rocrand_state_threefry2x32_20 *state)

Returns a normally distributed double value.

Generates and returns a normally distributed double value using ThreeFry generator in state, and increments position of the generator by one. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f.

Parameters:

state – - Pointer to a state to use

Returns:

Normally distributed double value

FQUALIFIERS double2 rocrand_normal_double2 (rocrand_state_threefry2x32_20 *state)

Returns two normally distributed double values.

Generates and returns two normally distributed double values using ThreeFry generator in state, and increments position of the generator by four. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f. The function uses the Box-Muller transform method to generate two normally distributed values, and returns both of them.

Parameters:

state – - Pointer to a state to use

Returns:

Two normally distributed double value as double2

FQUALIFIERS float rocrand_normal (rocrand_state_threefry2x64_20 *state)

Returns a normally distributed double value.

Generates and returns a normally distributed float value using ThreeFry generator in state, and increments position of the generator by one. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f.

Parameters:

state – - Pointer to a state to use

Returns:

Normally distributed float value

FQUALIFIERS float2 rocrand_normal2 (rocrand_state_threefry2x64_20 *state)

Returns two normally distributed float values.

Generates and returns two normally distributed float values using ThreeFry generator in state, and increments position of the generator by one. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f. The function uses the Box-Muller transform method to generate two normally distributed values, and returns both of them.

Parameters:

state – - Pointer to a state to use

Returns:

Two normally distributed float value as float2

FQUALIFIERS double rocrand_normal_double (rocrand_state_threefry2x64_20 *state)

Returns a normally distributed double value.

Generates and returns a normally distributed double value using ThreeFry generator in state, and increments position of the generator by one. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f.

Parameters:

state – - Pointer to a state to use

Returns:

Normally distributed double value

FQUALIFIERS double2 rocrand_normal_double2 (rocrand_state_threefry2x64_20 *state)

Returns two normally distributed double values.

Generates and returns two normally distributed double values using ThreeFry generator in state, and increments position of the generator by two. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f. The function uses the Box-Muller transform method to generate two normally distributed values, and returns both of them.

Parameters:

state – - Pointer to a state to use

Returns:

Two normally distributed double value as double2

FQUALIFIERS float rocrand_normal (rocrand_state_threefry4x32_20 *state)

Returns a normally distributed double value.

Generates and returns a normally distributed float value using ThreeFry generator in state, and increments position of the generator by one. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f.

Parameters:

state – - Pointer to a state to use

Returns:

Normally distributed float value

FQUALIFIERS float2 rocrand_normal2 (rocrand_state_threefry4x32_20 *state)

Returns two normally distributed float values.

Generates and returns two normally distributed float values using ThreeFry generator in state, and increments position of the generator by two. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f. The function uses the Box-Muller transform method to generate two normally distributed values, and returns both of them.

Parameters:

state – - Pointer to a state to use

Returns:

Two normally distributed float value as float2

FQUALIFIERS double rocrand_normal_double (rocrand_state_threefry4x32_20 *state)

Returns a normally distributed double value.

Generates and returns a normally distributed double value using ThreeFry generator in state, and increments position of the generator by one. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f.

Parameters:

state – - Pointer to a state to use

Returns:

Normally distributed double value

FQUALIFIERS double2 rocrand_normal_double2 (rocrand_state_threefry4x32_20 *state)

Returns two normally distributed double values.

Generates and returns two normally distributed double values using ThreeFry generator in state, and increments position of the generator by four. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f. The function uses the Box-Muller transform method to generate two normally distributed values, and returns both of them.

Parameters:

state – - Pointer to a state to use

Returns:

Two normally distributed double value as double2

FQUALIFIERS float rocrand_normal (rocrand_state_threefry4x64_20 *state)

Returns a normally distributed double value.

Generates and returns a normally distributed float value using ThreeFry generator in state, and increments position of the generator by one. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f.

Parameters:

state – - Pointer to a state to use

Returns:

Normally distributed float value

FQUALIFIERS float2 rocrand_normal2 (rocrand_state_threefry4x64_20 *state)

Returns two normally distributed float values.

Generates and returns two normally distributed float values using ThreeFry generator in state, and increments position of the generator by two. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f. The function uses the Box-Muller transform method to generate two normally distributed values, and returns both of them.

Parameters:

state – - Pointer to a state to use

Returns:

Two normally distributed float value as float2

FQUALIFIERS double rocrand_normal_double (rocrand_state_threefry4x64_20 *state)

Returns a normally distributed double value.

Generates and returns a normally distributed double value using ThreeFry generator in state, and increments position of the generator by one. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f.

Parameters:

state – - Pointer to a state to use

Returns:

Normally distributed double value

FQUALIFIERS double2 rocrand_normal_double2 (rocrand_state_threefry4x64_20 *state)

Returns two normally distributed double values.

Generates and returns two normally distributed double values using ThreeFry generator in state, and increments position of the generator by two. Used normal distribution has mean value equal to 0.0f, and standard deviation equal to 1.0f. The function uses the Box-Muller transform method to generate two normally distributed values, and returns both of them.

Parameters:

state – - Pointer to a state to use

Returns:

Two normally distributed double value as double2

FQUALIFIERS void rocrand_init (const unsigned long long seed, const unsigned long long subsequence, const unsigned long long offset, rocrand_state_philox4x32_10 *state)

Initializes Philox state.

Initializes the Philox generator state with the given seed, subsequence, and offset.

Parameters:
  • seed – - Value to use as a seed

  • subsequence – - Subsequence to start at

  • offset – - Absolute offset into subsequence

  • state – - Pointer to state to initialize

FQUALIFIERS unsigned int rocrand (rocrand_state_philox4x32_10 *state)

Returns uniformly distributed random unsigned int value from [0; 2^32 - 1] range.

Generates and returns uniformly distributed random unsigned int value from [0; 2^32 - 1] range using Philox generator in state. State is incremented by one position.

Parameters:

state – - Pointer to a state to use

Returns:

Pseudorandom value (32-bit) as an unsigned int

FQUALIFIERS uint4 rocrand4 (rocrand_state_philox4x32_10 *state)

Returns four uniformly distributed random unsigned int values from [0; 2^32 - 1] range.

Generates and returns four uniformly distributed random unsigned int values from [0; 2^32 - 1] range using Philox generator in state. State is incremented by four positions.

Parameters:

state – - Pointer to a state to use

Returns:

Four pseudorandom values (32-bit) as an uint4

FQUALIFIERS void skipahead (unsigned long long offset, rocrand_state_philox4x32_10 *state)

Updates Philox state to skip ahead by offset elements.

Updates the Philox generator state in state to skip ahead by offset elements.

Parameters:
  • offset – - Number of elements to skip

  • state – - Pointer to state to update

FQUALIFIERS void skipahead_subsequence (unsigned long long subsequence, rocrand_state_philox4x32_10 *state)

Updates Philox state to skip ahead by subsequence subsequences.

Updates the Philox generator state in state to skip ahead by subsequence subsequences. Each subsequence is 4 * 2^64 numbers long.

Parameters:
  • subsequence – - Number of subsequences to skip

  • state – - Pointer to state to update

FQUALIFIERS void skipahead_sequence (unsigned long long sequence, rocrand_state_philox4x32_10 *state)

Updates Philox state to skip ahead by sequence sequences.

Updates the Philox generator state in state skipping sequence sequences ahead. For Philox each sequence is 4 * 2^64 numbers long (equal to the size of a subsequence).

Parameters:
  • sequence – - Number of sequences to skip

  • state – - Pointer to state to update

FQUALIFIERS unsigned int rocrand_poisson (rocrand_state_philox4x32_10 *state, double lambda)

Returns a Poisson-distributed unsigned int using Philox generator.

Generates and returns Poisson-distributed distributed random unsigned int values using Philox generator in state. State is incremented by a variable amount.

Parameters:
  • state – - Pointer to a state to use

  • lambda – - Lambda parameter of the Poisson distribution

Returns:

Poisson-distributed unsigned int

FQUALIFIERS uint4 rocrand_poisson4 (rocrand_state_philox4x32_10 *state, double lambda)

Returns four Poisson-distributed unsigned int values using Philox generator.

Generates and returns Poisson-distributed distributed random unsigned int values using Philox generator in state. State is incremented by a variable amount.

Parameters:
  • state – - Pointer to a state to use

  • lambda – - Lambda parameter of the Poisson distribution

Returns:

Four Poisson-distributed unsigned int values as uint4

FQUALIFIERS unsigned int rocrand_poisson (rocrand_state_mrg31k3p *state, double lambda)

Returns a Poisson-distributed unsigned int using MRG31k3p generator.

Generates and returns Poisson-distributed distributed random unsigned int values using MRG31k3p generator in state. State is incremented by a variable amount.

Parameters:
  • state – - Pointer to a state to use

  • lambda – - Lambda parameter of the Poisson distribution

Returns:

Poisson-distributed unsigned int

FQUALIFIERS unsigned int rocrand_poisson (rocrand_state_mrg32k3a *state, double lambda)

Returns a Poisson-distributed unsigned int using MRG32k3a generator.

Generates and returns Poisson-distributed distributed random unsigned int values using MRG32k3a generator in state. State is incremented by a variable amount.

Parameters:
  • state – - Pointer to a state to use

  • lambda – - Lambda parameter of the Poisson distribution

Returns:

Poisson-distributed unsigned int

FQUALIFIERS unsigned int rocrand_poisson (rocrand_state_xorwow *state, double lambda)

Returns a Poisson-distributed unsigned int using XORWOW generator.

Generates and returns Poisson-distributed distributed random unsigned int values using XORWOW generator in state. State is incremented by a variable amount.

Parameters:
  • state – - Pointer to a state to use

  • lambda – - Lambda parameter of the Poisson distribution

Returns:

Poisson-distributed unsigned int

FQUALIFIERS unsigned int rocrand_poisson (rocrand_state_mtgp32 *state, double lambda)

Returns a Poisson-distributed unsigned int using MTGP32 generator.

Generates and returns Poisson-distributed distributed random unsigned int values using MTGP32 generator in state. State is incremented by one position.

Parameters:
  • state – - Pointer to a state to use

  • lambda – - Lambda parameter of the Poisson distribution

Returns:

Poisson-distributed unsigned int

FQUALIFIERS unsigned int rocrand_poisson (rocrand_state_sobol32 *state, double lambda)

Returns a Poisson-distributed unsigned int using SOBOL32 generator.

Generates and returns Poisson-distributed distributed random unsigned int values using SOBOL32 generator in state. State is incremented by one position.

Parameters:
  • state – - Pointer to a state to use

  • lambda – - Lambda parameter of the Poisson distribution

Returns:

Poisson-distributed unsigned int

FQUALIFIERS unsigned int rocrand_poisson (rocrand_state_scrambled_sobol32 *state, double lambda)

Returns a Poisson-distributed unsigned int using SCRAMBLED_SOBOL32 generator.

Generates and returns Poisson-distributed distributed random unsigned int values using SCRAMBLED_SOBOL32 generator in state. State is incremented by one position.

Parameters:
  • state – - Pointer to a state to use

  • lambda – - Lambda parameter of the Poisson distribution

Returns:

Poisson-distributed unsigned int

FQUALIFIERS unsigned long long int rocrand_poisson (rocrand_state_sobol64 *state, double lambda)

Returns a Poisson-distributed unsigned long long int using SOBOL64 generator.

Generates and returns Poisson-distributed distributed random unsigned long long int values using SOBOL64 generator in state. State is incremented by one position.

Parameters:
  • state – - Pointer to a state to use

  • lambda – - Lambda parameter of the Poisson distribution

Returns:

Poisson-distributed unsigned long long int

FQUALIFIERS unsigned long long int rocrand_poisson (rocrand_state_scrambled_sobol64 *state, double lambda)

Returns a Poisson-distributed unsigned long long int using SCRAMBLED_SOBOL64 generator.

Generates and returns Poisson-distributed distributed random unsigned long long int values using SCRAMBLED_SOBOL64 generator in state. State is incremented by one position.

Parameters:
  • state – - Pointer to a state to use

  • lambda – - Lambda parameter of the Poisson distribution

Returns:

Poisson-distributed unsigned long long int

FQUALIFIERS unsigned int rocrand_poisson (rocrand_state_lfsr113 *state, double lambda)

Returns a Poisson-distributed unsigned int using LFSR113 generator.

Generates and returns Poisson-distributed distributed random unsigned int values using LFSR113 generator in state. State is incremented by one position.

Parameters:
  • state – - Pointer to a state to use

  • lambda – - Lambda parameter of the Poisson distribution

Returns:

Poisson-distributed unsigned int

FQUALIFIERS unsigned int rocrand_poisson (rocrand_state_threefry2x32_20 *state, double lambda)

Returns a Poisson-distributed unsigned int using ThreeFry generator.

Generates and returns Poisson-distributed distributed random unsigned int values using ThreeFry generator in state. State is incremented by one position.

Parameters:
  • state – - Pointer to a state to use

  • lambda – - Lambda parameter of the Poisson distribution

Returns:

Poisson-distributed unsigned int

FQUALIFIERS unsigned int rocrand_poisson (rocrand_state_threefry2x64_20 *state, double lambda)

Returns a Poisson-distributed unsigned int using ThreeFry generator.

Generates and returns Poisson-distributed distributed random unsigned int values using ThreeFry generator in state. State is incremented by one position.

Parameters:
  • state – - Pointer to a state to use

  • lambda – - Lambda parameter of the Poisson distribution

Returns:

Poisson-distributed unsigned int

FQUALIFIERS unsigned int rocrand_poisson (rocrand_state_threefry4x32_20 *state, double lambda)

Returns a Poisson-distributed unsigned int using ThreeFry generator.

Generates and returns Poisson-distributed distributed random unsigned int values using ThreeFry generator in state. State is incremented by one position.

Parameters:
  • state – - Pointer to a state to use

  • lambda – - Lambda parameter of the Poisson distribution

Returns:

Poisson-distributed unsigned int

FQUALIFIERS unsigned int rocrand_poisson (rocrand_state_threefry4x64_20 *state, double lambda)

Returns a Poisson-distributed unsigned int using ThreeFry generator.

Generates and returns Poisson-distributed distributed random unsigned int values using ThreeFry generator in state. State is incremented by one position.

Parameters:
  • state – - Pointer to a state to use

  • lambda – - Lambda parameter of the Poisson distribution

Returns:

Poisson-distributed unsigned int

FQUALIFIERS void rocrand_init (const unsigned int *vectors, const unsigned int scramble_constant, const unsigned int offset, rocrand_state_scrambled_sobol32 *state)

Initialize scrambled_sobol32 state.

Initializes the scrambled_sobol32 generator state with the given direction vectors and offset.

Parameters:
  • vectors – - Direction vectors

  • scramble_constant – - Constant used for scrambling the sequence

  • offset – - Absolute offset into sequence

  • state – - Pointer to state to initialize

FQUALIFIERS unsigned int rocrand (rocrand_state_scrambled_sobol32 *state)

Returns uniformly distributed random unsigned int value from [0; 2^32 - 1] range.

Generates and returns uniformly distributed random unsigned int value from [0; 2^32 - 1] range using scrambled_sobol32 generator in state. State is incremented by one position.

Parameters:

state – - Pointer to a state to use

Returns:

Quasirandom value (32-bit) as an unsigned int

FQUALIFIERS void skipahead (unsigned long long offset, rocrand_state_scrambled_sobol32 *state)

Updates SCRAMBLED_SOBOL32 state to skip ahead by offset elements.

Updates the SCRAMBLED_SOBOL32 state in state to skip ahead by offset elements.

Parameters:
  • offset – - Number of elements to skip

  • state – - Pointer to state to update

FQUALIFIERS void rocrand_init (const unsigned long long int *vectors, const unsigned long long int scramble_constant, const unsigned int offset, rocrand_state_scrambled_sobol64 *state)

Initialize scrambled_sobol64 state.

Initializes the scrambled_sobol64 generator state with the given direction vectors and offset.

Parameters:
  • vectors – - Direction vectors

  • scramble_constant – - Constant used for scrambling the sequence

  • offset – - Absolute offset into sequence

  • state – - Pointer to state to initialize

FQUALIFIERS unsigned long long int rocrand (rocrand_state_scrambled_sobol64 *state)

Returns uniformly distributed random unsigned int value from [0; 2^64 - 1] range.

Generates and returns uniformly distributed random unsigned int value from [0; 2^64 - 1] range using scrambled_sobol64 generator in state. State is incremented by one position.

Parameters:

state – - Pointer to a state to use

Returns:

Quasirandom value (64-bit) as an unsigned int

FQUALIFIERS void skipahead (unsigned long long offset, rocrand_state_scrambled_sobol64 *state)

Updates scrambled_sobol64 state to skip ahead by offset elements.

Updates the scrambled_sobol64 state in state to skip ahead by offset elements.

Parameters:
  • offset – - Number of elements to skip

  • state – - Pointer to state to update

FQUALIFIERS void rocrand_init (const unsigned int *vectors, const unsigned int offset, rocrand_state_sobol32 *state)

Initialize SOBOL32 state.

Initializes the SOBOL32 generator state with the given direction vectors and offset.

Parameters:
  • vectors – - Direction vectors

  • offset – - Absolute offset into sequence

  • state – - Pointer to state to initialize

FQUALIFIERS unsigned int rocrand (rocrand_state_sobol32 *state)

Returns uniformly distributed random unsigned int value from [0; 2^32 - 1] range.

Generates and returns uniformly distributed random unsigned int value from [0; 2^32 - 1] range using Sobol32 generator in state. State is incremented by one position.

Parameters:

state – - Pointer to a state to use

Returns:

Quasirandom value (32-bit) as an unsigned int

FQUALIFIERS void skipahead (unsigned long long offset, rocrand_state_sobol32 *state)

Updates SOBOL32 state to skip ahead by offset elements.

Updates the SOBOL32 state in state to skip ahead by offset elements.

Parameters:
  • offset – - Number of elements to skip

  • state – - Pointer to state to update

FQUALIFIERS void rocrand_init (const unsigned long long int *vectors, const unsigned int offset, rocrand_state_sobol64 *state)

Initialize sobol64 state.

Initializes the sobol64 generator state with the given direction vectors and offset.

Parameters:
  • vectors – - Direction vectors

  • offset – - Absolute offset into sequence

  • state – - Pointer to state to initialize

FQUALIFIERS unsigned long long int rocrand (rocrand_state_sobol64 *state)

Returns uniformly distributed random unsigned int value from [0; 2^64 - 1] range.

Generates and returns uniformly distributed random unsigned int value from [0; 2^64 - 1] range using sobol64 generator in state. State is incremented by one position.

Parameters:

state – - Pointer to a state to use

Returns:

Quasirandom value (64-bit) as an unsigned int

FQUALIFIERS void skipahead (unsigned long long int offset, rocrand_state_sobol64 *state)

Updates sobol64 state to skip ahead by offset elements.

Updates the sobol64 state in state to skip ahead by offset elements.

Parameters:
  • offset – - Number of elements to skip

  • state – - Pointer to state to update

FQUALIFIERS float rocrand_uniform (rocrand_state_philox4x32_10 *state)

Returns a uniformly distributed random float value from (0; 1] range.

Generates and returns a uniformly distributed float value from (0; 1] range (excluding 0.0f, including 1.0f) using Philox generator in state, and increments position of the generator by one.

Parameters:

state – - Pointer to a state to use

Returns:

Uniformly distributed float value from (0; 1] range.

FQUALIFIERS float2 rocrand_uniform2 (rocrand_state_philox4x32_10 *state)

Returns two uniformly distributed random float values from (0; 1] range.

Generates and returns two uniformly distributed float values from (0; 1] range (excluding 0.0f, including 1.0f) using Philox generator in state, and increments position of the generator by two.

Parameters:

state – - Pointer to a state to use

Returns:

Two uniformly distributed float values from (0; 1] range as float2.

FQUALIFIERS float4 rocrand_uniform4 (rocrand_state_philox4x32_10 *state)

Returns four uniformly distributed random float values from (0; 1] range.

Generates and returns four uniformly distributed float values from (0; 1] range (excluding 0.0f, including 1.0f) using Philox generator in state, and increments position of the generator by four.

Parameters:

state – - Pointer to a state to use

Returns:

Four uniformly distributed float values from (0; 1] range as float4.

FQUALIFIERS double rocrand_uniform_double (rocrand_state_philox4x32_10 *state)

Returns a uniformly distributed random double value from (0; 1] range.

Generates and returns a uniformly distributed double value from (0; 1] range (excluding 0.0, including 1.0) using Philox generator in state, and increments position of the generator by two.

Parameters:

state – - Pointer to a state to use

Returns:

Uniformly distributed double value from (0; 1] range.

FQUALIFIERS double2 rocrand_uniform_double2 (rocrand_state_philox4x32_10 *state)

Returns two uniformly distributed random double values from (0; 1] range.

Generates and returns two uniformly distributed double values from (0; 1] range (excluding 0.0, including 1.0) using Philox generator in state, and increments position of the generator by four.

Parameters:

state – - Pointer to a state to use

Returns:

Two uniformly distributed double values from (0; 1] range as double2.

FQUALIFIERS double4 rocrand_uniform_double4 (rocrand_state_philox4x32_10 *state)

Returns four uniformly distributed random double values from (0; 1] range.

Generates and returns four uniformly distributed double values from (0; 1] range (excluding 0.0, including 1.0) using Philox generator in state, and increments position of the generator by eight.

Parameters:

state – - Pointer to a state to use

Returns:

Four uniformly distributed double values from (0; 1] range as double4.

FQUALIFIERS float rocrand_uniform (rocrand_state_mrg31k3p *state)

Returns a uniformly distributed random float value from (0; 1] range.

Generates and returns a uniformly distributed float value from (0; 1] range (excluding 0.0f, including 1.0f) using MRG31K3P generator in state, and increments position of the generator by one.

Parameters:

state – - Pointer to a state to use

Returns:

Uniformly distributed float value from (0; 1] range.

FQUALIFIERS double rocrand_uniform_double (rocrand_state_mrg31k3p *state)

Returns a uniformly distributed random double value from (0; 1] range.

Generates and returns a uniformly distributed double value from (0; 1] range (excluding 0.0, including 1.0) using MRG31K3P generator in state, and increments position of the generator by one.

Note: In this implementation returned double value is generated from only 32 random bits (one unsigned int value).

Parameters:

state – - Pointer to a state to use

Returns:

Uniformly distributed double value from (0; 1] range.

FQUALIFIERS float rocrand_uniform (rocrand_state_mrg32k3a *state)

Returns a uniformly distributed random float value from (0; 1] range.

Generates and returns a uniformly distributed float value from (0; 1] range (excluding 0.0f, including 1.0f) using MRG32K3A generator in state, and increments position of the generator by one.

Parameters:

state – - Pointer to a state to use

Returns:

Uniformly distributed float value from (0; 1] range.

FQUALIFIERS double rocrand_uniform_double (rocrand_state_mrg32k3a *state)

Returns a uniformly distributed random double value from (0; 1] range.

Generates and returns a uniformly distributed double value from (0; 1] range (excluding 0.0, including 1.0) using MRG32K3A generator in state, and increments position of the generator by one.

Note: In this implementation returned double value is generated from only 32 random bits (one unsigned int value).

Parameters:

state – - Pointer to a state to use

Returns:

Uniformly distributed double value from (0; 1] range.

FQUALIFIERS float rocrand_uniform (rocrand_state_xorwow *state)

Returns a uniformly distributed random float value from (0; 1] range.

Generates and returns a uniformly distributed float value from (0; 1] range (excluding 0.0f, including 1.0f) using XORWOW generator in state, and increments position of the generator by one.

Parameters:

state – - Pointer to a state to use

Returns:

Uniformly distributed float value from (0; 1] range.

FQUALIFIERS double rocrand_uniform_double (rocrand_state_xorwow *state)

Returns a uniformly distributed random double value from (0; 1] range.

Generates and returns a uniformly distributed double value from (0; 1] range (excluding 0.0, including 1.0) using MRG32K3A generator in state, and increments position of the generator by two.

Parameters:

state – - Pointer to a state to use

Returns:

Uniformly distributed double value from (0; 1] range.

FQUALIFIERS float rocrand_uniform (rocrand_state_mtgp32 *state)

Returns a uniformly distributed random float value from (0; 1] range.

Generates and returns a uniformly distributed float value from (0; 1] range (excluding 0.0f, including 1.0f) using MTGP32 generator in state, and increments position of the generator by one.

Parameters:

state – - Pointer to a state to use

Returns:

Uniformly distributed float value from (0; 1] range.

FQUALIFIERS double rocrand_uniform_double (rocrand_state_mtgp32 *state)

Returns a uniformly distributed random double value from (0; 1] range.

Generates and returns a uniformly distributed double value from (0; 1] range (excluding 0.0, including 1.0) using MTGP32 generator in state, and increments position of the generator by one.

Note: In this implementation returned double value is generated from only 32 random bits (one unsigned int value).

Parameters:

state – - Pointer to a state to use

Returns:

Uniformly distributed double value from (0; 1] range.

FQUALIFIERS float rocrand_uniform (rocrand_state_sobol32 *state)

Returns a uniformly distributed random float value from (0; 1] range.

Generates and returns a uniformly distributed float value from (0; 1] range (excluding 0.0f, including 1.0f) using SOBOL32 generator in state, and increments position of the generator by one.

Parameters:

state – - Pointer to a state to use

Returns:

Uniformly distributed float value from (0; 1] range.

FQUALIFIERS double rocrand_uniform_double (rocrand_state_sobol32 *state)

Returns a uniformly distributed random double value from (0; 1] range.

Generates and returns a uniformly distributed double value from (0; 1] range (excluding 0.0, including 1.0) using SOBOL32 generator in state, and increments position of the generator by one.

Note: In this implementation returned double value is generated from only 32 random bits (one unsigned int value).

Parameters:

state – - Pointer to a state to use

Returns:

Uniformly distributed double value from (0; 1] range.

FQUALIFIERS float rocrand_uniform (rocrand_state_scrambled_sobol32 *state)

Returns a uniformly distributed random float value from (0; 1] range.

Generates and returns a uniformly distributed float value from (0; 1] range (excluding 0.0f, including 1.0f) using SCRAMBLED_SOBOL32 generator in state, and increments position of the generator by one.

Parameters:

state – - Pointer to a state to use

Returns:

Uniformly distributed float value from (0; 1] range.

FQUALIFIERS double rocrand_uniform_double (rocrand_state_scrambled_sobol32 *state)

Returns a uniformly distributed random double value from (0; 1] range.

Generates and returns a uniformly distributed double value from (0; 1] range (excluding 0.0, including 1.0) using SCRAMBLED_SOBOL32 generator in state, and increments position of the generator by one.

Note: In this implementation returned double value is generated from only 32 random bits (one unsigned int value).

Parameters:

state – - Pointer to a state to use

Returns:

Uniformly distributed double value from (0; 1] range.

FQUALIFIERS float rocrand_uniform (rocrand_state_sobol64 *state)

Returns a uniformly distributed random float value from (0; 1] range.

Generates and returns a uniformly distributed float value from (0; 1] range (excluding 0.0, including 1.0) using SOBOL64 generator in state, and increments position of the generator by one.

Parameters:

state – - Pointer to a state to use

Returns:

Uniformly distributed float value from (0; 1] range.

FQUALIFIERS double rocrand_uniform_double (rocrand_state_sobol64 *state)

Returns a uniformly distributed random double value from (0; 1] range.

Generates and returns a uniformly distributed double value from (0; 1] range (excluding 0.0, including 1.0) using SOBOL64 generator in state, and increments position of the generator by one.

Parameters:

state – - Pointer to a state to use

Returns:

Uniformly distributed double value from (0; 1] range.

FQUALIFIERS float rocrand_uniform (rocrand_state_scrambled_sobol64 *state)

Returns a uniformly distributed random float value from (0; 1] range.

Generates and returns a uniformly distributed float value from (0; 1] range (excluding 0.0, including 1.0) using SCRAMBLED_SOBOL64 generator in state, and increments position of the generator by one.

Parameters:

state – - Pointer to a state to use

Returns:

Uniformly distributed float value from (0; 1] range.

FQUALIFIERS double rocrand_uniform_double (rocrand_state_scrambled_sobol64 *state)

Returns a uniformly distributed random double value from (0; 1] range.

Generates and returns a uniformly distributed double value from (0; 1] range (excluding 0.0, including 1.0) using SCRAMBLED_SOBOL64 generator in state, and increments position of the generator by one.

Parameters:

state – - Pointer to a state to use

Returns:

Uniformly distributed double value from (0; 1] range.

FQUALIFIERS float rocrand_uniform (rocrand_state_lfsr113 *state)

Returns a uniformly distributed random float value from (0; 1] range.

Generates and returns a uniformly distributed float value from (0; 1] range (excluding 0.0f, including 1.0f) using LFSR113 generator in state, and increments position of the generator by one.

Parameters:

state – - Pointer to a state to use

Returns:

Uniformly distributed float value from (0; 1] range.

FQUALIFIERS double rocrand_uniform_double (rocrand_state_lfsr113 *state)

Returns a uniformly distributed random double value from (0; 1] range.

Generates and returns a uniformly distributed double value from (0; 1] range (excluding 0.0, including 1.0) using LFSR113 generator in state, and increments position of the generator by one.

Note: In this implementation returned double value is generated from only 32 random bits (one unsigned int value).

Parameters:

state – - Pointer to a state to use

Returns:

Uniformly distributed double value from (0; 1] range.

FQUALIFIERS float rocrand_uniform (rocrand_state_threefry2x32_20 *state)

Returns a uniformly distributed random float value from (0; 1] range.

Generates and returns a uniformly distributed float value from (0; 1] range (excluding 0.0, including 1.0) using ThreeFry generator in state, and increments position of the generator by one.

Parameters:

state – - Pointer to a state to use

Returns:

Uniformly distributed float value from (0; 1] range.

FQUALIFIERS double rocrand_uniform_double (rocrand_state_threefry2x32_20 *state)

Returns a uniformly distributed random double value from (0; 1] range.

Generates and returns a uniformly distributed double value from (0; 1] range (excluding 0.0, including 1.0) using ThreeFry generator in state, and increments position of the generator by one.

Note: In this implementation returned double value is generated from only 32 random bits (one unsigned int value).

Parameters:

state – - Pointer to a state to use

Returns:

Uniformly distributed double value from (0; 1] range.

FQUALIFIERS float rocrand_uniform (rocrand_state_threefry2x64_20 *state)

Returns a uniformly distributed random float value from (0; 1] range.

Generates and returns a uniformly distributed float value from (0; 1] range (excluding 0.0, including 1.0) using ThreeFry generator in state, and increments position of the generator by one.

Parameters:

state – - Pointer to a state to use

Returns:

Uniformly distributed float value from (0; 1] range.

FQUALIFIERS double rocrand_uniform_double (rocrand_state_threefry2x64_20 *state)

Returns a uniformly distributed random double value from (0; 1] range.

Generates and returns a uniformly distributed double value from (0; 1] range (excluding 0.0, including 1.0) using ThreeFry generator in state, and increments position of the generator by one.

Note: In this implementation returned double value is generated from only 32 random bits (one unsigned int value).

Parameters:

state – - Pointer to a state to use

Returns:

Uniformly distributed double value from (0; 1] range.

FQUALIFIERS float rocrand_uniform (rocrand_state_threefry4x32_20 *state)

Returns a uniformly distributed random float value from (0; 1] range.

Generates and returns a uniformly distributed float value from (0; 1] range (excluding 0.0, including 1.0) using ThreeFry generator in state, and increments position of the generator by one.

Parameters:

state – - Pointer to a state to use

Returns:

Uniformly distributed float value from (0; 1] range.

FQUALIFIERS double rocrand_uniform_double (rocrand_state_threefry4x32_20 *state)

Returns a uniformly distributed random double value from (0; 1] range.

Generates and returns a uniformly distributed double value from (0; 1] range (excluding 0.0, including 1.0) using ThreeFry generator in state, and increments position of the generator by one.

Note: In this implementation returned double value is generated from only 32 random bits (one unsigned int value).

Parameters:

state – - Pointer to a state to use

Returns:

Uniformly distributed double value from (0; 1] range.

FQUALIFIERS float rocrand_uniform (rocrand_state_threefry4x64_20 *state)

Returns a uniformly distributed random float value from (0; 1] range.

Generates and returns a uniformly distributed float value from (0; 1] range (excluding 0.0, including 1.0) using ThreeFry generator in state, and increments position of the generator by one.

Parameters:

state – - Pointer to a state to use

Returns:

Uniformly distributed float value from (0; 1] range.

FQUALIFIERS double rocrand_uniform_double (rocrand_state_threefry4x64_20 *state)

Returns a uniformly distributed random double value from (0; 1] range.

Generates and returns a uniformly distributed double value from (0; 1] range (excluding 0.0, including 1.0) using ThreeFry generator in state, and increments position of the generator by one.

Note: In this implementation returned double value is generated from only 32 random bits (one unsigned int value).

Parameters:

state – - Pointer to a state to use

Returns:

Uniformly distributed double value from (0; 1] range.

FQUALIFIERS void rocrand_init (const unsigned long long seed, const unsigned long long subsequence, const unsigned long long offset, rocrand_state_xorwow *state)

Initialize XORWOW state.

Initializes the XORWOW generator state with the given seed, subsequence, and offset.

Parameters:
  • seed – - Value to use as a seed

  • subsequence – - Subsequence to start at

  • offset – - Absolute offset into subsequence

  • state – - Pointer to state to initialize

FQUALIFIERS unsigned int rocrand (rocrand_state_xorwow *state)

Returns uniformly distributed random unsigned int value from [0; 2^32 - 1] range.

Generates and returns uniformly distributed random unsigned int value from [0; 2^32 - 1] range using XORWOW generator in state. State is incremented by one position.

Parameters:

state – - Pointer to a state to use

Returns:

Pseudorandom value (32-bit) as an unsigned int

FQUALIFIERS void skipahead (unsigned long long offset, rocrand_state_xorwow *state)

Updates XORWOW state to skip ahead by offset elements.

Updates the XORWOW state in state to skip ahead by offset elements.

Parameters:
  • offset – - Number of elements to skip

  • state – - Pointer to state to update

FQUALIFIERS void skipahead_subsequence (unsigned long long subsequence, rocrand_state_xorwow *state)

Updates XORWOW state to skip ahead by subsequence subsequences.

Updates the XORWOW state to skip ahead by subsequence subsequences. Each subsequence is 2^67 numbers long.

Parameters:
  • subsequence – - Number of subsequences to skip

  • state – - Pointer to state to update

FQUALIFIERS void skipahead_sequence (unsigned long long sequence, rocrand_state_xorwow *state)

Updates XORWOW state to skip ahead by sequence sequences.

Updates the XORWOW state skipping sequence sequences ahead. For XORWOW each sequence is 2^67 numbers long (equal to the size of a subsequence).

Parameters:
  • sequence – - Number of sequences to skip

  • state – - Pointer to state to update

namespace rocrand_device#

Typedefs

typedef mtgp32_params_fast_t mtgp32_fast_params#

Functions

inline void rocrand_mtgp32_init_state(unsigned int array[], const mtgp32_fast_params *para, unsigned int seed)#
template<class value> FQUALIFIERS int threefry_rotation_array (int index)
template<> FQUALIFIERS int threefry_rotation_array< unsigned int > (int index)
template<> FQUALIFIERS int threefry_rotation_array< unsigned long long > (int index)
template<class value> FQUALIFIERS int threefry_rotation_array (int indexX, int indexY)
template<> FQUALIFIERS int threefry_rotation_array< unsigned int > (int indexX, int indexY)
template<> FQUALIFIERS int threefry_rotation_array< unsigned long long > (int indexX, int indexY)
template<typename value> FQUALIFIERS value rotl (value x, int d)
template<> FQUALIFIERS unsigned long long rotl< unsigned long long > (unsigned long long x, int d)
template<> FQUALIFIERS unsigned int rotl< unsigned int > (unsigned int x, int d)
template<typename value> FQUALIFIERS value skein_ks_parity ()
template<> FQUALIFIERS unsigned int skein_ks_parity< unsigned int > ()
template<> FQUALIFIERS unsigned long long skein_ks_parity< unsigned long long > ()

C Host API#

group rocrandhost

Defines

ROCRAND_DEFAULT_MAX_BLOCK_SIZE#

The default maximum number of threads per block.

Typedefs

typedef enum rocrand_status rocrand_status

rocRAND function call status type

typedef enum rocrand_rng_type rocrand_rng_type

rocRAND generator type

typedef enum rocrand_ordering rocrand_ordering

rocRAND generator ordering

typedef enum rocrand_direction_vector_set rocrand_direction_vector_set

rocRAND vector set

Enums

enum rocrand_status#

rocRAND function call status type

Values:

enumerator ROCRAND_STATUS_SUCCESS#

No errors.

enumerator ROCRAND_STATUS_VERSION_MISMATCH#

Header file and linked library version do not match.

enumerator ROCRAND_STATUS_NOT_CREATED#

Generator was not created using rocrand_create_generator.

enumerator ROCRAND_STATUS_ALLOCATION_FAILED#

Memory allocation failed during execution.

enumerator ROCRAND_STATUS_TYPE_ERROR#

Generator type is wrong.

enumerator ROCRAND_STATUS_OUT_OF_RANGE#

Argument out of range.

enumerator ROCRAND_STATUS_LENGTH_NOT_MULTIPLE#

Requested size is not a multiple of quasirandom generator’s dimension, or requested size is not even (see rocrand_generate_normal()), or pointer is misaligned (see rocrand_generate_normal())

enumerator ROCRAND_STATUS_DOUBLE_PRECISION_REQUIRED#

GPU does not have double precision.

enumerator ROCRAND_STATUS_LAUNCH_FAILURE#

Kernel launch failure.

enumerator ROCRAND_STATUS_INTERNAL_ERROR#

Internal library error.

enum rocrand_rng_type#

rocRAND generator type

Values:

enumerator ROCRAND_RNG_PSEUDO_DEFAULT#

Default pseudorandom generator.

enumerator ROCRAND_RNG_PSEUDO_XORWOW#

XORWOW pseudorandom generator.

enumerator ROCRAND_RNG_PSEUDO_MRG32K3A#

MRG32k3a pseudorandom generator.

enumerator ROCRAND_RNG_PSEUDO_MTGP32#

Mersenne Twister MTGP32 pseudorandom generator.

enumerator ROCRAND_RNG_PSEUDO_PHILOX4_32_10#

PHILOX-4x32-10 pseudorandom generator.

enumerator ROCRAND_RNG_PSEUDO_MRG31K3P#

MRG31k3p pseudorandom generator.

enumerator ROCRAND_RNG_PSEUDO_LFSR113#

LFSR113 pseudorandom generator.

enumerator ROCRAND_RNG_PSEUDO_MT19937#

Mersenne Twister MT19937 pseudorandom generator.

enumerator ROCRAND_RNG_PSEUDO_THREEFRY2_32_20#

ThreeFry 32 bit state size 2 pseudorandom generator.

enumerator ROCRAND_RNG_PSEUDO_THREEFRY2_64_20#

ThreeFry 64 bit state size 2 pseudorandom generator.

enumerator ROCRAND_RNG_PSEUDO_THREEFRY4_32_20#

ThreeFry 32 bit state size 4 pseudorandom generator.

enumerator ROCRAND_RNG_PSEUDO_THREEFRY4_64_20#

ThreeFry 64 bit state size 4 pseudorandom generator.

enumerator ROCRAND_RNG_QUASI_DEFAULT#

Default quasirandom generator.

enumerator ROCRAND_RNG_QUASI_SOBOL32#

Sobol32 quasirandom generator.

enumerator ROCRAND_RNG_QUASI_SCRAMBLED_SOBOL32#

Scrambled Sobol32 quasirandom generator.

enumerator ROCRAND_RNG_QUASI_SOBOL64#

Sobol64 quasirandom generator.

enumerator ROCRAND_RNG_QUASI_SCRAMBLED_SOBOL64#

Scrambled Sobol64 quasirandom generator.

enum rocrand_ordering#

rocRAND generator ordering

Values:

enumerator ROCRAND_ORDERING_PSEUDO_BEST#

Best ordering for pseudorandom results.

enumerator ROCRAND_ORDERING_PSEUDO_DEFAULT#

Default ordering for pseudorandom results.

enumerator ROCRAND_ORDERING_PSEUDO_SEEDED#

Fast lower quality pseudorandom results.

enumerator ROCRAND_ORDERING_PSEUDO_LEGACY#

Legacy ordering for pseudorandom results.

enumerator ROCRAND_ORDERING_PSEUDO_DYNAMIC#

Adjust to the device executing the generator.

enumerator ROCRAND_ORDERING_QUASI_DEFAULT#

n-dimensional ordering for quasirandom results

enum rocrand_direction_vector_set#

rocRAND vector set

Values:

enumerator ROCRAND_DIRECTION_VECTORS_32_JOEKUO6#
enumerator ROCRAND_SCRAMBLED_DIRECTION_VECTORS_32_JOEKUO6#
enumerator ROCRAND_DIRECTION_VECTORS_64_JOEKUO6#
enumerator ROCRAND_SCRAMBLED_DIRECTION_VECTORS_64_JOEKUO6#

Functions

rocrand_status ROCRANDAPI rocrand_create_generator (rocrand_generator *generator, rocrand_rng_type rng_type)

Creates a new random number generator.

Creates a new pseudo random number generator of type rng_type and returns it in generator.

Values for rng_type are:

  • ROCRAND_RNG_PSEUDO_XORWOW

  • ROCRAND_RNG_PSEUDO_MRG31K3P

  • ROCRAND_RNG_PSEUDO_MRG32K3A

  • ROCRAND_RNG_PSEUDO_MTGP32

  • ROCRAND_RNG_PSEUDO_PHILOX4_32_10

  • ROCRAND_RNG_PSEUDO_LFSR113

  • ROCRAND_RNG_PSEUDO_THREEFRY2_32_20

  • ROCRAND_RNG_PSEUDO_THREEFRY2_64_20

  • ROCRAND_RNG_PSEUDO_THREEFRY4_32_20

  • ROCRAND_RNG_PSEUDO_THREEFRY4_64_20

  • ROCRAND_RNG_QUASI_SOBOL32

  • ROCRAND_RNG_QUASI_SCRAMBLED_SOBOL32

  • ROCRAND_RNG_QUASI_SOBOL64

  • ROCRAND_RNG_QUASI_SCRAMBLED_SOBOL64

Parameters:
  • generator – - Pointer to generator

  • rng_type – - Type of generator to create

Returns:

  • ROCRAND_STATUS_ALLOCATION_FAILED, if memory could not be allocated

  • ROCRAND_STATUS_VERSION_MISMATCH if the header file version does not match the dynamically linked library version

  • ROCRAND_STATUS_TYPE_ERROR if the value for rng_type is invalid

  • ROCRAND_STATUS_SUCCESS if generator was created successfully

rocrand_status ROCRANDAPI rocrand_destroy_generator (rocrand_generator generator)

Destroys random number generator.

Destroys random number generator and frees related memory.

Parameters:

generator – - Generator to be destroyed

Returns:

  • ROCRAND_STATUS_NOT_CREATED if the generator wasn’t created

  • ROCRAND_STATUS_SUCCESS if generator was destroyed successfully

rocrand_status ROCRANDAPI rocrand_generate (rocrand_generator generator, unsigned int *output_data, size_t n)

Generates uniformly distributed 32-bit unsigned integers.

Generates n uniformly distributed 32-bit unsigned integers and saves them to output_data.

Generated numbers are between 0 and 2^32, including 0 and excluding 2^32.

Parameters:
  • generator – - Generator to use

  • output_data – - Pointer to memory to store generated numbers

  • n – - Number of 32-bit unsigned integers to generate

Returns:

  • ROCRAND_STATUS_NOT_CREATED if the generator wasn’t created

  • ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed

  • ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if n is not a multiple of the dimension of used quasi-random generator

  • ROCRAND_STATUS_SUCCESS if random numbers were successfully generated

rocrand_status ROCRANDAPI rocrand_generate_long_long (rocrand_generator generator, unsigned long long int *output_data, size_t n)

Generates uniformly distributed 64-bit unsigned integers.

Generates n uniformly distributed 64-bit unsigned integers and saves them to output_data.

Generated numbers are between 0 and 2^64, including 0 and excluding 2^64.

Parameters:
  • generator – - Generator to use

  • output_data – - Pointer to memory to store generated numbers

  • n – - Number of 64-bit unsigned integers to generate

Returns:

  • ROCRAND_STATUS_NOT_CREATED if the generator wasn’t created

  • ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed

  • ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if n is not a multiple of the dimension of used quasi-random generator

  • ROCRAND_TYPE_ERROR if the generator can’t natively generate 64-bit random numbers

  • ROCRAND_STATUS_SUCCESS if random numbers were successfully generated

rocrand_status ROCRANDAPI rocrand_generate_char (rocrand_generator generator, unsigned char *output_data, size_t n)

Generates uniformly distributed 8-bit unsigned integers.

Generates n uniformly distributed 8-bit unsigned integers and saves them to output_data.

Generated numbers are between 0 and 2^8, including 0 and excluding 2^8.

Parameters:
  • generator – - Generator to use

  • output_data – - Pointer to memory to store generated numbers

  • n – - Number of 8-bit unsigned integers to generate

Returns:

  • ROCRAND_STATUS_NOT_CREATED if the generator wasn’t created

  • ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed

  • ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if n is not a multiple of the dimension of used quasi-random generator

  • ROCRAND_STATUS_SUCCESS if random numbers were successfully generated

rocrand_status ROCRANDAPI rocrand_generate_short (rocrand_generator generator, unsigned short *output_data, size_t n)

Generates uniformly distributed 16-bit unsigned integers.

Generates n uniformly distributed 16-bit unsigned integers and saves them to output_data.

Generated numbers are between 0 and 2^16, including 0 and excluding 2^16.

Parameters:
  • generator – - Generator to use

  • output_data – - Pointer to memory to store generated numbers

  • n – - Number of 16-bit unsigned integers to generate

Returns:

  • ROCRAND_STATUS_NOT_CREATED if the generator wasn’t created

  • ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed

  • ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if n is not a multiple of the dimension of used quasi-random generator

  • ROCRAND_STATUS_SUCCESS if random numbers were successfully generated

rocrand_status ROCRANDAPI rocrand_generate_uniform (rocrand_generator generator, float *output_data, size_t n)

Generates uniformly distributed float values.

Generates n uniformly distributed 32-bit floating-point values and saves them to output_data.

Generated numbers are between 0.0f and 1.0f, excluding 0.0f and including 1.0f.

Parameters:
  • generator – - Generator to use

  • output_data – - Pointer to memory to store generated numbers

  • n – - Number of floats to generate

Returns:

  • ROCRAND_STATUS_NOT_CREATED if the generator wasn’t created

  • ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed

  • ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if n is not a multiple of the dimension of used quasi-random generator

  • ROCRAND_STATUS_SUCCESS if random numbers were successfully generated

rocrand_status ROCRANDAPI rocrand_generate_uniform_double (rocrand_generator generator, double *output_data, size_t n)

Generates uniformly distributed double-precision floating-point values.

Generates n uniformly distributed 64-bit double-precision floating-point values and saves them to output_data.

Generated numbers are between 0.0 and 1.0, excluding 0.0 and including 1.0.

Parameters:
  • generator – - Generator to use

  • output_data – - Pointer to memory to store generated numbers

  • n – - Number of doubles to generate

Returns:

  • ROCRAND_STATUS_NOT_CREATED if the generator wasn’t created

  • ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed

  • ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if n is not a multiple of the dimension of used quasi-random generator

  • ROCRAND_STATUS_SUCCESS if random numbers were successfully generated

rocrand_status ROCRANDAPI rocrand_generate_uniform_half (rocrand_generator generator, half *output_data, size_t n)

Generates uniformly distributed half-precision floating-point values.

Generates n uniformly distributed 16-bit half-precision floating-point values and saves them to output_data.

Generated numbers are between 0.0 and 1.0, excluding 0.0 and including 1.0.

Parameters:
  • generator – - Generator to use

  • output_data – - Pointer to memory to store generated numbers

  • n – - Number of halfs to generate

Returns:

  • ROCRAND_STATUS_NOT_CREATED if the generator wasn’t created

  • ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed

  • ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if n is not a multiple of the dimension of used quasi-random generator

  • ROCRAND_STATUS_SUCCESS if random numbers were successfully generated

rocrand_status ROCRANDAPI rocrand_generate_normal (rocrand_generator generator, float *output_data, size_t n, float mean, float stddev)

Generates normally distributed float values.

Generates n normally distributed distributed 32-bit floating-point values and saves them to output_data.

Parameters:
  • generator – - Generator to use

  • output_data – - Pointer to memory to store generated numbers

  • n – - Number of floats to generate

  • mean – - Mean value of normal distribution

  • stddev – - Standard deviation value of normal distribution

Returns:

  • ROCRAND_STATUS_NOT_CREATED if the generator wasn’t created

  • ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed

  • ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if n is not a multiple of the dimension of used quasi-random generator

  • ROCRAND_STATUS_SUCCESS if random numbers were successfully generated

rocrand_status ROCRANDAPI rocrand_generate_normal_double (rocrand_generator generator, double *output_data, size_t n, double mean, double stddev)

Generates normally distributed double values.

Generates n normally distributed 64-bit double-precision floating-point numbers and saves them to output_data.

Parameters:
  • generator – - Generator to use

  • output_data – - Pointer to memory to store generated numbers

  • n – - Number of doubles to generate

  • mean – - Mean value of normal distribution

  • stddev – - Standard deviation value of normal distribution

Returns:

  • ROCRAND_STATUS_NOT_CREATED if the generator wasn’t created

  • ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed

  • ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if n is not a multiple of the dimension of used quasi-random generator

  • ROCRAND_STATUS_SUCCESS if random numbers were successfully generated

rocrand_status ROCRANDAPI rocrand_generate_normal_half (rocrand_generator generator, half *output_data, size_t n, half mean, half stddev)

Generates normally distributed half values.

Generates n normally distributed 16-bit half-precision floating-point numbers and saves them to output_data.

Parameters:
  • generator – - Generator to use

  • output_data – - Pointer to memory to store generated numbers

  • n – - Number of halfs to generate

  • mean – - Mean value of normal distribution

  • stddev – - Standard deviation value of normal distribution

Returns:

  • ROCRAND_STATUS_NOT_CREATED if the generator wasn’t created

  • ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed

  • ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if n is not a multiple of the dimension of used quasi-random generator

  • ROCRAND_STATUS_SUCCESS if random numbers were successfully generated

rocrand_status ROCRANDAPI rocrand_generate_log_normal (rocrand_generator generator, float *output_data, size_t n, float mean, float stddev)

Generates log-normally distributed float values.

Generates n log-normally distributed 32-bit floating-point values and saves them to output_data.

Parameters:
  • generator – - Generator to use

  • output_data – - Pointer to memory to store generated numbers

  • n – - Number of floats to generate

  • mean – - Mean value of log normal distribution

  • stddev – - Standard deviation value of log normal distribution

Returns:

  • ROCRAND_STATUS_NOT_CREATED if the generator wasn’t created

  • ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed

  • ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if n is not a multiple of the dimension of used quasi-random generator

  • ROCRAND_STATUS_SUCCESS if random numbers were successfully generated

rocrand_status ROCRANDAPI rocrand_generate_log_normal_double (rocrand_generator generator, double *output_data, size_t n, double mean, double stddev)

Generates log-normally distributed double values.

Generates n log-normally distributed 64-bit double-precision floating-point values and saves them to output_data.

Parameters:
  • generator – - Generator to use

  • output_data – - Pointer to memory to store generated numbers

  • n – - Number of doubles to generate

  • mean – - Mean value of log normal distribution

  • stddev – - Standard deviation value of log normal distribution

Returns:

  • ROCRAND_STATUS_NOT_CREATED if the generator wasn’t created

  • ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed

  • ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if n is not a multiple of the dimension of used quasi-random generator

  • ROCRAND_STATUS_SUCCESS if random numbers were successfully generated

rocrand_status ROCRANDAPI rocrand_generate_log_normal_half (rocrand_generator generator, half *output_data, size_t n, half mean, half stddev)

Generates log-normally distributed half values.

Generates n log-normally distributed 16-bit half-precision floating-point values and saves them to output_data.

Parameters:
  • generator – - Generator to use

  • output_data – - Pointer to memory to store generated numbers

  • n – - Number of halfs to generate

  • mean – - Mean value of log normal distribution

  • stddev – - Standard deviation value of log normal distribution

Returns:

  • ROCRAND_STATUS_NOT_CREATED if the generator wasn’t created

  • ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed

  • ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if n is not a multiple of the dimension of used quasi-random generator

  • ROCRAND_STATUS_SUCCESS if random numbers were successfully generated

rocrand_status ROCRANDAPI rocrand_generate_poisson (rocrand_generator generator, unsigned int *output_data, size_t n, double lambda)

Generates Poisson-distributed 32-bit unsigned integers.

Generates n Poisson-distributed 32-bit unsigned integers and saves them to output_data.

Parameters:
  • generator – - Generator to use

  • output_data – - Pointer to memory to store generated numbers

  • n – - Number of 32-bit unsigned integers to generate

  • lambda – - lambda for the Poisson distribution

Returns:

  • ROCRAND_STATUS_NOT_CREATED if the generator wasn’t created

  • ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed

  • ROCRAND_STATUS_OUT_OF_RANGE if lambda is non-positive

  • ROCRAND_STATUS_LENGTH_NOT_MULTIPLE if n is not a multiple of the dimension of used quasi-random generator

  • ROCRAND_STATUS_SUCCESS if random numbers were successfully generated

rocrand_status ROCRANDAPI rocrand_initialize_generator (rocrand_generator generator)

Initializes the generator’s state on GPU or host.

Initializes the generator’s state on GPU or host. User it not required to call this function before using a generator.

If rocrand_initialize() was not called for a generator, it will be automatically called by functions which generates random numbers like rocrand_generate(), rocrand_generate_uniform() etc.

Parameters:

generator – - Generator to initialize

Returns:

  • ROCRAND_STATUS_NOT_CREATED if the generator wasn’t created

  • ROCRAND_STATUS_LAUNCH_FAILURE if a HIP kernel launch failed

  • ROCRAND_STATUS_SUCCESS if the seeds were generated successfully

rocrand_status ROCRANDAPI rocrand_set_stream (rocrand_generator generator, hipStream_t stream)

Sets the current stream for kernel launches.

Sets the current stream for all kernel launches of the generator. All functions will use this stream.

Parameters:
  • generator – - Generator to modify

  • stream – - Stream to use or NULL for default stream

Returns:

  • ROCRAND_STATUS_NOT_CREATED if the generator wasn’t created

  • ROCRAND_STATUS_SUCCESS if stream was set successfully

rocrand_status ROCRANDAPI rocrand_set_seed (rocrand_generator generator, unsigned long long seed)

Sets the seed of a pseudo-random number generator.

Sets the seed of the pseudo-random number generator.

  • This operation resets the generator’s internal state.

  • This operation does not change the generator’s offset.

For an MRG32K3a or MRG31K3p generator the seed value can’t be zero. If seed is equal to zero and generator’s type is ROCRAND_RNG_PSEUDO_MRG32K3A or ROCRAND_RNG_PSEUDO_MRG31K3P, value 12345 is used as seed instead.

For a LFSR113 generator seed values must be larger than 1, 7, 15,

  1. The seed upper and lower 32 bits used as first and second seed value. If those values smaller than 2 and/or 8, those are increased with 1 and/or 7.

Parameters:
  • generator – - Pseudo-random number generator

  • seed – - New seed value

Returns:

  • ROCRAND_STATUS_NOT_CREATED if the generator wasn’t created

  • ROCRAND_STATUS_TYPE_ERROR if the generator is a quasi-random number generator

  • ROCRAND_STATUS_SUCCESS if seed was set successfully

rocrand_status ROCRANDAPI rocrand_set_seed_uint4 (rocrand_generator generator, uint4 seed)

Sets the seeds of a pseudo-random number generator.

Sets the seed of the pseudo-random number generator. Currently only for LFSR113

  • This operation resets the generator’s internal state.

  • This operation does not change the generator’s offset.

Only usable for LFSR113.

For a LFSR113 generator seed values must be bigger than 1, 7, 15,

  1. If those values smaller, than the requested minimum values [2, 8, 16, 128], then it will be increased with the minimum values minus 1 [1, 7, 15, 127].

Parameters:
  • generator – - Pseudo-random number generator

  • seed – - New seed value

Returns:

  • ROCRAND_STATUS_NOT_CREATED if the generator wasn’t created

  • ROCRAND_STATUS_TYPE_ERROR if the generator is a quasi-random number generator

  • ROCRAND_STATUS_SUCCESS if seed was set successfully

rocrand_status ROCRANDAPI rocrand_set_offset (rocrand_generator generator, unsigned long long offset)

Sets the offset of a random number generator.

Sets the absolute offset of the random number generator.

  • This operation resets the generator’s internal state.

  • This operation does not change the generator’s seed.

Absolute offset cannot be set if generator’s type is ROCRAND_RNG_PSEUDO_MTGP32 or ROCRAND_RNG_PSEUDO_LFSR113.

Parameters:
  • generator – - Random number generator

  • offset – - New absolute offset

Returns:

  • ROCRAND_STATUS_NOT_CREATED if the generator wasn’t created

  • ROCRAND_STATUS_SUCCESS if offset was successfully set

  • ROCRAND_STATUS_TYPE_ERROR if generator’s type is ROCRAND_RNG_PSEUDO_MTGP32 or ROCRAND_RNG_PSEUDO_LFSR113

rocrand_status ROCRANDAPI rocrand_set_ordering (rocrand_generator generator, rocrand_ordering order)

Sets the ordering of a random number generator.

Sets the ordering of the results of a random number generator.

  • This operation resets the generator’s internal state.

  • This operation does not change the generator’s seed.

The ordering choices for pseudorandom sequences are ROCRAND_ORDERING_PSEUDO_DEFAULT and ROCRAND_ORDERING_PSEUDO_LEGACY. The default ordering is ROCRAND_ORDERING_PSEUDO_DEFAULT, which is equal to ROCRAND_ORDERING_PSEUDO_LEGACY for now.

For quasirandom sequences there is only one ordering, ROCRAND_ORDERING_QUASI_DEFAULT.

Parameters:
  • generator – - Random number generator

  • order – - New ordering of results

Returns:

  • ROCRAND_STATUS_NOT_CREATED if the generator wasn’t created

  • ROCRAND_STATUS_OUT_OF_RANGE if the ordering is not valid

  • ROCRAND_STATUS_SUCCESS if the ordering was successfully set

  • ROCRAND_STATUS_TYPE_ERROR if generator’s type is not valid

rocrand_status ROCRANDAPI rocrand_set_quasi_random_generator_dimensions (rocrand_generator generator, unsigned int dimensions)

Set the number of dimensions of a quasi-random number generator.

Set the number of dimensions of a quasi-random number generator. Supported values of dimensions are 1 to 20000.

  • This operation resets the generator’s internal state.

  • This operation does not change the generator’s offset.

Parameters:
  • generator – - Quasi-random number generator

  • dimensions – - Number of dimensions

Returns:

  • ROCRAND_STATUS_NOT_CREATED if the generator wasn’t created

  • ROCRAND_STATUS_TYPE_ERROR if the generator is not a quasi-random number generator

  • ROCRAND_STATUS_OUT_OF_RANGE if dimensions is out of range

  • ROCRAND_STATUS_SUCCESS if the number of dimensions was set successfully

rocrand_status ROCRANDAPI rocrand_get_version (int *version)

Returns the version number of the library.

Returns in version the version number of the dynamically linked rocRAND library.

Parameters:

version – - Version of the library

Returns:

  • ROCRAND_STATUS_OUT_OF_RANGE if version is NULL

  • ROCRAND_STATUS_SUCCESS if the version number was successfully returned

rocrand_status ROCRANDAPI rocrand_create_poisson_distribution (double lambda, rocrand_discrete_distribution *discrete_distribution)

Construct the histogram for a Poisson distribution.

Construct the histogram for the Poisson distribution with lambda lambda.

Parameters:
  • lambda – - lambda for the Poisson distribution

  • discrete_distribution – - pointer to the histogram in device memory

Returns:

  • ROCRAND_STATUS_ALLOCATION_FAILED if memory could not be allocated

  • ROCRAND_STATUS_OUT_OF_RANGE if discrete_distribution pointer was null

  • ROCRAND_STATUS_OUT_OF_RANGE if lambda is non-positive

  • ROCRAND_STATUS_SUCCESS if the histogram was constructed successfully

rocrand_status ROCRANDAPI rocrand_create_discrete_distribution (const double *probabilities, unsigned int size, unsigned int offset, rocrand_discrete_distribution *discrete_distribution)

Construct the histogram for a custom discrete distribution.

Construct the histogram for the discrete distribution of size 32-bit unsigned integers from the range [offset, offset + size) using probabilities as probabilities.

Parameters:
  • probabilities – - probabilities of the the distribution in host memory

  • size – - size of probabilities

  • offset – - offset of values

  • discrete_distribution – - pointer to the histogram in device memory

Returns:

  • ROCRAND_STATUS_ALLOCATION_FAILED if memory could not be allocated

  • ROCRAND_STATUS_OUT_OF_RANGE if discrete_distribution pointer was null

  • ROCRAND_STATUS_OUT_OF_RANGE if size was zero

  • ROCRAND_STATUS_SUCCESS if the histogram was constructed successfully

rocrand_status ROCRANDAPI rocrand_destroy_discrete_distribution (rocrand_discrete_distribution discrete_distribution)

Destroy the histogram array for a discrete distribution.

Destroy the histogram array for a discrete distribution created by rocrand_create_poisson_distribution.

Parameters:

discrete_distribution – - pointer to the histogram in device memory

Returns:

  • ROCRAND_STATUS_OUT_OF_RANGE if discrete_distribution was null

  • ROCRAND_STATUS_SUCCESS if the histogram was destroyed successfully

rocrand_status ROCRANDAPI rocrand_get_direction_vectors32 (const unsigned int **vectors, rocrand_direction_vector_set set)

Get the vector for 32-bit (scrambled-)sobol generation.

Parameters:
  • vectors – - location where to write the vector pointer to

  • set – - which direction vector set to use

Returns:

  • ROCRAND_STATUS_OUT_OF_RANGE if set was invalid for this method

  • ROCRAND_STATUS_SUCCESS if the pointer was set succesfully

rocrand_status ROCRANDAPI rocrand_get_direction_vectors64 (const unsigned long long **vectors, rocrand_direction_vector_set set)

Get the vector for 64-bit (scrambled-)sobol generation.

Parameters:
  • vectors – - location where to write the vector pointer to

  • set – - which direction vector set to use

Returns:

  • ROCRAND_STATUS_OUT_OF_RANGE if set was invalid for this method

  • ROCRAND_STATUS_SUCCESS if the pointer was set succesfully

rocrand_status ROCRANDAPI rocrand_get_scramble_constants32 (const unsigned int **constants)

Get the scramble constants for 32-bit scrambled sobol generation.

Parameters:

constants – - location where to write the constants pointer to

Returns:

  • ROCRAND_STATUS_SUCCESS if the pointer was set succesfully

rocrand_status ROCRANDAPI rocrand_get_scramble_constants64 (const unsigned long long **constants)

Get the scramble constants for 64-bit scrambled sobol generation.

Parameters:

constants – - location where to write the constants pointer to

Returns:

  • ROCRAND_STATUS_SUCCESS if the pointer was set succesfully

C++ Host API Wrapper#

group rocrandhostcpp

Typedefs

typedef philox4x32_10_engine philox4x32_10#

Typedef of rocrand_cpp::philox4x32_10_engine PRNG engine with default seed (ROCRAND_PHILOX4x32_DEFAULT_SEED).

typedef xorwow_engine xorwow#

Typedef of rocrand_cpp::xorwow_engine PRNG engine with default seed (ROCRAND_XORWOW_DEFAULT_SEED).

typedef mrg31k3p_engine mrg31k3p#

Typedef of rocrand_cpp::mrg31k3p_engine PRNG engine with default seed (ROCRAND_MRG31K3P_DEFAULT_SEED).

typedef mrg32k3a_engine mrg32k3a#

Typedef of rocrand_cpp::mrg32k3a_engine PRNG engine with default seed (ROCRAND_MRG32K3A_DEFAULT_SEED).

typedef mtgp32_engine mtgp32#

Typedef of rocrand_cpp::mtgp32_engine PRNG engine with default seed (0).

typedef lfsr113_engine lfsr113#

Typedef of rocrand_cpp::lfsr113_engine PRNG engine with default seed (ROCRAND_LFSR113_DEFAULT_SEED_X, ROCRAND_LFSR113_DEFAULT_SEED_Y, ROCRAND_LFSR113_DEFAULT_SEED_Z, ROCRAND_LFSR113_DEFAULT_SEED_W).

typedef mt19937_engine mt19937#

Typedef of rocrand_cpp::mt19937_engine PRNG engine with default seed (0).

typedef threefry2x32_20_engine threefry2x32#

Typedef of rocrand_cpp::threefry2x32_20_engine PRNG engine with default seed (0).

typedef threefry2x64_20_engine threefry2x64#

Typedef of rocrand_cpp::threefry2x64_20_engine PRNG engine with default seed (0).

typedef threefry4x32_20_engine threefry4x32#

Typedef of rocrand_cpp::threefry4x32_20_engine PRNG engine with default seed (0).

typedef threefry4x64_20_engine threefry4x64#

Typedef of rocrand_cpp::threefry4x64_20_engine PRNG engine with default seed (0).

typedef sobol32_engine sobol32#

Typedef of rocrand_cpp::sobol32_engine QRNG engine with default number of dimensions (1).

typedef scrambled_sobol32_engine scrambled_sobol32#

Typedef of rocrand_cpp::scrambled_sobol32_engine QRNG engine with default number of dimensions (1).

typedef sobol64_engine sobol64#

Typedef of rocrand_cpp::sobol64_engine QRNG engine with default number of dimensions (1).

typedef scrambled_sobol64_engine scrambled_sobol64#

Typedef of rocrand_cpp::scrambled_sobol64_engine QRNG engine with default number of dimensions (1).

typedef xorwow default_random_engine#

Default random engine.

typedef std::random_device random_device#

A non-deterministic uniform random number generator.

rocrand_cpp::random_device is non-deterministic uniform random number generator, or a pseudo-random number engine if there is no support for non-deterministic random number generation. It’s implemented as a typedef of std::random_device.

For practical use rocrand_cpp::random_device is generally only used to seed a PRNG such as rocrand_cpp::mtgp32_engine.

Example:

#include <rocrand/rocrand.hpp>

int main()
{
    const size_t size = 8192;
    unsigned int * output;
    hipMalloc(&output, size * sizeof(unsigned int));

    rocrand_cpp::random_device rd;
    rocrand_cpp::mtgp32 engine(rd()); // seed engine with a real random value, if available
    rocrand_cpp::normal_distribution<float> dist(0.0, 1.5);
    dist(engine, output, size);
}

Functions

inline int version()#

Returns rocRAND version.

Returns:

rocRAND version number as an int value.

class error : public exception#
#include <rocrand.hpp>

A run-time rocRAND error.

The error class represents an error returned by a rocRAND function.

template<class IntType = unsigned int>
class uniform_int_distribution#
#include <rocrand.hpp>

Produces random integer values uniformly distributed on the interval [0, 2^(sizeof(IntType)*8) - 1].

Template Parameters:

IntType – - type of generated values. Only unsigned char, unsigned short and unsigned int and unsigned long long int type is supported.

template<class RealType = float>
class uniform_real_distribution#
#include <rocrand.hpp>

Produces random floating-point values uniformly distributed on the interval (0, 1].

Template Parameters:

RealType – - type of generated values. Only float, double and half types are supported.

template<class RealType = float>
class normal_distribution#
#include <rocrand.hpp>

Produces random numbers according to a normal distribution.

Template Parameters:

RealType – - type of generated values. Only float, double and half types are supported.

template<class RealType = float>
class lognormal_distribution#
#include <rocrand.hpp>

Produces positive random numbers according to a log-normal distribution.

Template Parameters:

RealType – - type of generated values. Only float, double and half types are supported.

template<class IntType = unsigned int>
class poisson_distribution#
#include <rocrand.hpp>

Produces random non-negative integer values distributed according to Poisson distribution.

Template Parameters:

IntType – - type of generated values. Only unsinged int type is supported.

template<unsigned long long DefaultSeed = ROCRAND_PHILOX4x32_DEFAULT_SEED>
class philox4x32_10_engine#
#include <rocrand.hpp>

Pseudorandom number engine based Philox algorithm.

It generates random numbers of type unsigned int on the interval [0; 2^32 - 1]. Random numbers are generated in sets of four.

template<unsigned long long DefaultSeed = ROCRAND_XORWOW_DEFAULT_SEED>
class xorwow_engine#
#include <rocrand.hpp>

Pseudorandom number engine based XORWOW algorithm.

xorwow_engine is a xorshift pseudorandom number engine based on XORWOW algorithm. It produces random numbers of type unsigned int on the interval [0; 2^32 - 1].

template<unsigned long long DefaultSeed = ROCRAND_MRG31K3P_DEFAULT_SEED>
class mrg31k3p_engine#
#include <rocrand.hpp>

Pseudorandom number engine based MRG31k3p CMRG.

mrg31k3p_engine is an implementation of MRG31k3p pseudorandom number generator, which is a Combined Multiple Recursive Generator (CMRG) created by Pierre L’Ecuyer. It produces random 32-bit unsigned int values on the interval [0; 2^32 - 1].

template<unsigned long long DefaultSeed = ROCRAND_MRG32K3A_DEFAULT_SEED>
class mrg32k3a_engine#
#include <rocrand.hpp>

Pseudorandom number engine based MRG32k3a CMRG.

mrg32k3a_engine is an implementation of MRG32k3a pseudorandom number generator, which is a Combined Multiple Recursive Generator (CMRG) created by Pierre L’Ecuyer. It produces random 32-bit unsigned int values on the interval [0; 2^32 - 1].

template<unsigned long long DefaultSeed = 0>
class mtgp32_engine#
#include <rocrand.hpp>

Random number engine based on the Mersenne Twister for Graphic Processors algorithm.

mtgp32_engine is a random number engine based on the Mersenne Twister for Graphic Processors algorithm, which is a version of well-known Mersenne Twister algorithm. It produces high quality random numbers of type unsigned int on the interval [0; 2^32 - 1].

template<unsigned int DefaultSeedX = ROCRAND_LFSR113_DEFAULT_SEED_X, unsigned int DefaultSeedY = ROCRAND_LFSR113_DEFAULT_SEED_Y, unsigned int DefaultSeedZ = ROCRAND_LFSR113_DEFAULT_SEED_Z, unsigned int DefaultSeedW = ROCRAND_LFSR113_DEFAULT_SEED_W>
class lfsr113_engine#
#include <rocrand.hpp>

Random number engine based on the LFSR113 algorithm.

lfsr113_engine is an implementation of LFSR113 pseudorandom number generator, which is a linear feedback shift resgisters (LFSR) based generator created by Pierre L’Ecuyer. It produces random 32-bit unsigned int values on the interval [0; 2^32 - 1].

template<unsigned long long DefaultSeed = 0ULL>
class mt19937_engine#
#include <rocrand.hpp>

Random number engine based on the Mersenne Twister algorithm.

mt19937 is a random number engine based on the Mersenne Twister algorithm as proposed in “Mersenne Twister: A 623-Dimensionally Equidistributed Uniform

Pseudo-Random Number Generator”. It produces high quality random numbers of type

unsigned int on the interval [0; 2^32 - 1].

template<unsigned int DefaultNumDimensions = 1>
class sobol32_engine#
#include <rocrand.hpp>

Sobol’s quasi-random sequence generator.

sobol32_engine is quasi-random number engine which produced Sobol sequences. This implementation supports generating sequences in up to 20,000 dimensions. The engine produces random unsigned integers on the interval [0, 2^32 - 1].

template<unsigned int DefaultNumDimensions = 1>
class scrambled_sobol32_engine#
#include <rocrand.hpp>

Sobol’s scrambled quasi-random sequence generator.

scrambled_sobol32_engine is a quasi-random number engine which produces scrambled Sobol sequences. This implementation supports generating sequences in up to 20,000 dimensions. The engine produces random unsigned integers on the interval [0, 2^32 - 1].

template<unsigned int DefaultNumDimensions = 1>
class sobol64_engine#
#include <rocrand.hpp>

Sobol’s quasi-random sequence generator.

sobol64 is a quasi-random number engine which produces Sobol sequences. This implementation supports generating sequences in up to 20,000 dimensions. The engine produces random unsigned integers on the interval [0, 2^64 - 1].

template<unsigned int DefaultNumDimensions = 1>
class scrambled_sobol64_engine#
#include <rocrand.hpp>

Sobol’s scrambled quasi-random sequence generator.

scrambled_sobol64_engine is a quasi-random number engine which produces scrambled Sobol sequences. This implementation supports generating sequences in up to 20,000 dimensions. The engine produces random unsigned long long integers on the interval [0, 2^64 - 1].

template<unsigned long long DefaultSeed = 0>
class threefry2x32_20_engine#
#include <rocrand.hpp>

Pseudorandom number engine based on 2 state ThreeFry.

It generates random numbers of type unsigned int on the interval [0; 2^32 - 1]. Random numbers are generated in sets of two.

template<unsigned long long DefaultSeed = 0>
class threefry2x64_20_engine#
#include <rocrand.hpp>

Pseudorandom number engine based 2 state ThreeFry.

It generates random numbers of type unsigned int on the interval [0; 2^62 - 1]. Random numbers are generated in sets of two.

template<unsigned long long DefaultSeed = 0>
class threefry4x32_20_engine#
#include <rocrand.hpp>

Pseudorandom number engine based on 2 state ThreeFry.

It generates random numbers of type unsigned int on the interval [0; 2^32 - 1]. Random numbers are generated in sets of two.

template<unsigned long long DefaultSeed = 0>
class threefry4x64_20_engine#
#include <rocrand.hpp>

Pseudorandom number engine based 2 state ThreeFry.

It generates random numbers of type unsigned int on the interval [0; 2^62 - 1]. Random numbers are generated in sets of two.