Generation Functions

nvplRandGenerate

nvplRandGenerate() is used to generate pseudo- or quasirandom bits of output for XORWOW, MRG32k3a, MT19937, Philox_4x32_10, PCG, SOBOL32, and Scrambled SOBOL32 generators. Each output element is a 32-bit unsigned integer where all bits are random. nvplRandGenerate() returns NVPL_RAND_STATUS_GENERATOR_TYPE_ERROR for SOBOL64 or Scrambled SOBOL64 generators.

nvplRandStatus_t nvplRandGenerate(nvplRandGenerator_t gen, unsigned int *outputPtr, const size_t num)

nvplRandGenerateLongLong

nvplRandGenerateLongLong() is used to generate pseudo- or quasirandom bits of output for PCG, SOBOL64, and Scrambled SOBOL64 generators. Each output element is a 64-bit unsigned integer where all bits are random. nvplRandGenerateLongLong() returns NVPL_RAND_STATUS_GENERATOR_TYPE_ERROR for SOBOL32 or Scrambled SOBOL32 generators, as well all the pseudorandom generators except PCG.

nvplRandStatus_t nvplRandGenerateLongLong(nvplRandGenerator_t gen, unsigned long long *outputPtr, const size_t num)

nvplRandGenerateUniform

nvplRandGenerateUniform() is used to generate uniformly distributed FP32 values in the range of (0.0, 1.0], where 0.0 is excluded and 1.0 is included.

nvplRandStatus_t nvplRandGenerateUniform(nvplRandGenerator_t gen, float *outputPtr, const size_t num)

nvplRandGenerateUniformDouble

nvplRandGenerateUniformDouble() is used to generate uniformly distributed FP64 values in the range of (0.0, 1.0], where 0.0 is excluded and 1.0 is included.

nvplRandStatus_t nvplRandGenerateUniformDouble(nvplRandGenerator_t gen, double *outputPtr, const size_t num)

nvplRandGenerateUniformRange

nvplRandGenerateUniformRange() is used to generate uniformly distributed FP32 values in the range of (start, end], where start is excluded and end is included.

nvplRandStatus_t nvplRandGenerateUniformRange(nvplRandGenerator_t gen, float *outputPtr, const size_t num, const float start, const float end)

nvplRandGenerateUniformRangeDouble

nvplRandGenerateUniformRangeDouble() is used to generate uniformly distributed FP64 values in the range of (start, end], where start is excluded and end is included.

nvplRandStatus_t nvplRandGenerateUniformDouble(nvplRandGenerator_t gen, double *outputPtr, const size_t num)

nvplRandGenerateNormal

nvplRandGenerateNormal() is used to generate normally distributed FP32 values with the given mean and standard deviation.

nvplRandStatus_t nvplRandGenerateNormal(nvplRandGenerator_t gen, float *outputPtr, const size_t num, const float mean, const float stddev)

nvplRandGenerateNormalDouble

nvplRandGenerateNormal() is used to generate normally distributed FP64 values with the given mean and standard deviation.

nvplRandStatus_t nvplRandGenerateNormalDouble(nvplRandGenerator_t gen, double *outputPtr, const size_t num, const double mean, const double stddev)

nvplRandGenerateDistribution

nvplRandGenerateDistribution() is used to generate FP32 values based on the continuous distribution type and parameters specified by config. NVPL RAND library supports the following continuous distributions:

  • Uniform

  • Normal

  • Lognormal

  • Exponential

  • Gamma

  • Beta

  • Dirichlet

nvplRandStatus_t nvplRandGenerateDistribution(nvplRandGenerator_t gen, float *outputPtr, const nvplRandDistributionConfig_t config, const size_t num)

nvplRandGenerateDistributionDouble

nvplRandGenerateDistributionDouble() is used to generate FP64 values based on the continuous distribution type and parameters specified by config.

nvplRandStatus_t nvplRandGenerateDistributionDouble(nvplRandGenerator_t gen, double *outputPtr, const nvplRandDistributionConfig_t config, const size_t num)

nvplRandGenerateDistributionDiscrete

nvplRandGenerateDistributionDiscrete() is used to generate unsigned 32-bit interger values based on the discrete distribution type and parameters specified by config. NVPL RAND library supports the following discrete distributions:

  • Poisson

  • Bernoulli

  • Categorical

  • Binomial

  • Multinomial

nvplRandStatus_t nvplRandGenerateDistributionDiscrete(nvplRandGenerator_t gen, unsigned int *outputPtr, const nvplRandDistributionConfig_t distConfig, const size_t num)