muRAND API Reference
1 Introduction
The muRAND library provides functions mainly used to generate high-quality pseudo-random and quasi-random numbers. On top of Moore Threads® MUSA® runtime, this library provides access to parallel computational resources of Moore Threads Graphics Processing Unit (GPU) in a simple and efficient way.
The muRAND consists of random generation functions on the host and device sides. These functions can be called on either hosts or devices, but the random number generation is produced on devices only. In addition, the device side functions offer flexibility to self-define states of random-number generators.
The supported random number generators are listed as follows.
- XORWOW
- MRG32k3a
- MTGP
- Philox_4_32_
- Sobol
- Sobol
- Scrambled Sobol
- Scrambled Sobol
In this version, muRAND supports both single and double precision data types.
2 Module Index
2.1 Modules
Here is a list of all modules:
- Host API
- Device API
3 Module Documentation
3.1 Host API
Macros
- #define MURAND_DEFAULT_MAX_BLOCK_SIZE 256
Typedefs
- typedef enum murandStatus murandStatus_t Returns status codes.
- typedef enum murandRngType murandRngType_t Random number generators are created by calling murandCreateGenerator(). These generators can divided into two groups as follows.
- typedef enum murandOrdering murandOrdering_t The ordering of muRAND generators.
Enumerations
- enum murandStatus {
MURAND_STATUS_SUCCESS = 0 ,
MURAND_STATUS_VERSION_MISMATCH = 100 ,
MURAND_STATUS_NOT_CREATED = 101 ,
MURAND_STATUS_ALLOCATION_FAILED = 102 ,
MURAND_STATUS_TYPE_ERROR = 103 ,
MURAND_STATUS_OUT_OF_RANGE = 104 ,
MURAND_STATUS_LENGTH_NOT_MULTIPLE ,
MURAND_STATUS_DOUBLE_PRECISION_REQUIRED = 106 ,
MURAND_STATUS_LAUNCH_FAILURE = 107 ,
MURAND_STATUS_INTERNAL_ERROR = 108 ,
MURAND_STATUS_NOT_IMPLEMENTED = 1000 }
Returns status codes.
- enum murandRngType {
MURAND_RNG_PSEUDO_DEFAULT = 400 ,
MURAND_RNG_PSEUDO_XORWOW = 401 ,
MURAND_RNG_PSEUDO_MRG32K3A = 402 ,
MURAND_RNG_PSEUDO_MTGP32 = 403 ,
MURAND_RNG_PSEUDO_PHILOX4_32_10 = 404 ,
MURAND_RNG_QUASI_DEFAULT = 500 ,
MURAND_RNG_QUASI_SOBOL32 = 501 ,
MURAND_RNG_QUASI_SCRAMBLED_SOBOL32 = 502 ,
MURAND_RNG_QUASI_SOBOL64 = 504 ,
MURAND_RNG_QUASI_SCRAMBLED_SOBOL64 = 505 }
Random number generators are created by calling murandCreateGenerator(). These generators can divided into two groups as follows.
- enum murandOrdering {
MURAND_ORDERING_PSEUDO_BEST = 100 ,
MURAND_ORDERING_PSEUDO_DEFAULT = 101 ,
MURAND_ORDERING_PSEUDO_SEEDED = 102 ,
MURAND_ORDERING_PSEUDO_LEGACY = 103 ,
MURAND_ORDERING_PSEUDO_DYNAMIC = 104 ,
MURAND_ORDERING_QUASI_DEFAULT = 201 }
The ordering of muRAND generators.
- enum murandDirectionVectorSet {
MURAND_DIRECTION_VECTORS_32_JOEKUO6 ,
MURAND_SCRAMBLED_DIRECTION_VECTORS_32_JOEKUO6 ,
MURAND_DIRECTION_VECTORS_64_JOEKUO6 ,
MURAND_SCRAMBLED_DIRECTION_VECTORS_64_JOEKUO6 }
Functions
-
murandStatus_t MURANDAPI murandCreateGenerator (murandGenerator_t ∗generator, murandRngType_t rng_type)
Creates a new random number generator.
-
murandStatus_t MURANDAPI murandDestroyGenerator (murandGenerator_t generator)
Destroys the specified generator.
-
murandStatus_t MURANDAPI murandGenerate (murandGenerator_t generator, unsigned int ∗output_data, size_t n)
Generates uniformly distributed 32-bit unsigned integers.
-
murandStatus_t MURANDAPI murandGenerateLongLong (murandGenerator_t generator, unsigned long long int ∗output_data, size_t n)
Generates uniformly distributed 64-bit unsigned integers.
-
murandStatus_t MURANDAPI murandGenerateUniform (murandGenerator_t generator, float ∗output_data, size_t n)
Generates uniformly distributed
floatvalues. -
murandStatus_t MURANDAPI murandGenerateUniformDouble (murandGenerator_t generator, double ∗output_data, size_t n)
Generates uniformly distributed double-precision floating-point values.
-
murandStatus_t MURANDAPI murandGenerateNormal (murandGenerator_t generator, float ∗output_data, size_t n, float mean, float stddev)
Generates normally distributed
floatvalues. -
murandStatus_t MURANDAPI murandGenerateNormalDouble (murandGenerator_t generator, double ∗output_data, size_t n, double mean, double stddev)
Generates normally distributed
doublevalues. -
murandStatus_t MURANDAPI murandGenerateLogNormal (murandGenerator_t generator, float ∗output_ data, size_t n, float mean, float stddev)
Generates log-normally distributed
floatvalues. -
murandStatus_t MURANDAPI murandGenerateLogNormalDouble (murandGenerator_t generator, double ∗output_data, size_t n, double mean, double stddev)
Generates log-normally distributed
doublevalues. -
murandStatus_t MURANDAPI murandGeneratePoisson (murandGenerator_t generator, unsigned int ∗output_data, size_t n, double lambda)
Generates Poisson-distributed 32-bit unsigned integers.
-
murandStatus_t MURANDAPI murandGenerateSeeds (murandGenerator_t generator)
Setup starting states.
-
murandStatus_t MURANDAPI murandSetStream (murandGenerator_t generator, MUstream stream)
Sets the current stream for kernel launches.
-
murandStatus_t MURANDAPI murandSetPseudoRandomGeneratorSeed (murandGenerator_t generator, unsigned long long seed)
Sets the seed of the pseudo-random number generator.
-
murandStatus_t MURANDAPI murandSetGeneratorOffset (murandGenerator_t generator, unsigned long long offset)
Sets the offset of the random number generator.
-
murandStatus_t MURANDAPI murandSetGeneratorOrdering (murandGenerator_t generator, murandOrdering_t order)
Sets the order of the random number generator.
-
murandStatus_t MURANDAPI murandSetQuasiRandomGeneratorDimensions (murandGenerator_t genera tor, unsigned int dimensions)
Sets the number of dimensions of a quasi-random number generator.
-
murandStatus_t MURANDAPI murandGetVersion (int ∗version)
Returns the version of the library.
-
murandStatus_t MURANDAPI murandCreatePoissonDistribution (double lambda, murandDiscrete Distribution_t ∗discrete_distribution)
Constructs the histogram of the Poisson distribution.
-
murandStatus_t MURANDAPI murandDestroyDistribution (murandDiscreteDistribution_t discrete_ distribution)
Destroys the histogram array for the discrete distribution.
-
murandStatus_t MURANDAPI murandGetDirectionVectors32 (murandDirectionVectors32_t ∗vectors[ ], murandDirectionVectorSet_t set)
Gets the direction vector used to generate a 32-bit quasi-random number.
-
murandStatus_t MURANDAPI murandGetScrambleConstants32 (unsigned int ∗∗constants)
Gets scramble constants for 32-bit scrambled Sobol'.
-
murandStatus_t MURANDAPI murandGetDirectionVectors64 (murandDirectionVectors64_t ∗vectors[ ], murandDirectionVectorSet_t set)
Gets direction vectors for 64-bit quasirandom number generation.
-
murandStatus_t MURANDAPI murandGetScrambleConstants64 (unsigned long long∗∗constants)
Gets scramble constants for 64-bit scrambled Sobol'.
3.1.1 Detailed Description
This section describes muRAND host API.
3.1.2 Enumeration Type Documentation
3.1.2.1 murandDirectionVectorSet
enum murandDirectionVectorSet
MURAND array of 32-bit direction vectors. MURAND array of 64-bit direction vectors. MURAND choice of direction vector set.
Enumerator
MURAND_DIRECTION_VECTORS_32_JOEKUO6
The specific set of 32-bit direction vectors generated from polynomials, up to 20,000 dimensions.
MURAND_SCRAMBLED_DIRECTION_VECTORS_32_JOEKUO
The specific set of 32-bit direction vectors generated from polynomials, up to 20,000 dimensions, and scrambled.
MURAND_DIRECTION_VECTORS_64_JOEKUO6
The specific set of 64-bit direction vectors generated from polynomials, up to 20,000 dimensions.
MURAND_SCRAMBLED_DIRECTION_VECTORS_64_JOEKUO
The specific set of 64-bit direction vectors generated from polynomials, up to 20,000 dimensions, and scrambled.
3.1.2.2 murandOrdering
enum murandOrdering
The ordering of muRAND generators.
Enumerator
MURAND_ORDERING_PSEUDO_BEST
Optimal ordering of pseudorandom results.
MURAND_ORDERING_PSEUDO_DEFAULT
Default ordering of pseudorandom results.
MURAND_ORDERING_PSEUDO_SEEDED
Fast, lowe-quality pseudorandom results.
MURAND_ORDERING_PSEUDO_LEGACY
Legacy ordering of pseudorandom results.
MURAND_ORDERING_PSEUDO_DYNAMIC
Adjust the device executing the generator.
MURAND_ORDERING_QUASI_DEFAULT
n-dimensional ordering of quasirandom results.
3.1.2.3 murandRngType
enum murandRngType
Random number generators are created by calling murandCreateGenerator(). These generators can divided into two groups as follows.
Enumerator
MURAND_RNG_PSEUDO_DEFAULT
Default pseudorandom generator.
MURAND_RNG_PSEUDO_XORWOW
XORWOW pseudorandom generator.
MURAND_RNG_PSEUDO_MRG32K3A
MRG32k3a pseudorandom generator.
MURAND_RNG_PSEUDO_MTGP32
Mersenne Twister MTGP32 pseudorandom generator.
MURAND_RNG_PSEUDO_PHILOX4_32_10
PHILOX-4x32-10 pseudorandom generator.
MURAND_RNG_QUASI_DEFAULT
Default quasirandom generator.
MURAND_RNG_QUASI_SOBOL32
Sobol32 quasirandom generator.
MURAND_RNG_QUASI_SCRAMBLED_SOBOL32
Scrambled Sobol32 quasirandom generator.
MURAND_RNG_QUASI_SOBOL64
Sobol64 quasirandom generator.
MURAND_RNG_QUASI_SCRAMBLED_SOBOL64
Scrambled Sobol64 quasirandom generator.
3.1.2.4 murandStatus
enum murandStatus
Returns status codes.
Enumerator
MURAND_STATUS_SUCCESS
The muRAND operation was successful.
MURAND_STATUS_VERSION_MISMATCH
Unmatched header file and linked library version.
MURAND_STATUS_NOT_CREATED
The generator was not created by murandCreateGenerator().
MURAND_STATUS_ALLOCATION_FAILED
Failed to allocate memory.
MURAND_STATUS_TYPE_ERROR
Generator type error.
MURAND_STATUS_OUT_OF_RANGE
The passed argument is out of range.
MURAND_STATUS_LENGTH_NOT_MULTIPLE
Requested size is not a multiple of quasirandom generator's dimension, or requested size is not even (see murandGenerateNormal()), or pointer is misaligned (see murandGenerateNormal())
MURAND_STATUS_DOUBLE_PRECISION_ REQUIRED
Double precision is not supported on GPUs.
MURAND_STATUS_LAUNCH_FAILURE
Failed to kernel launch.
MURAND_STATUS_INTERNAL_ERROR
Internal library error.
MURAND_STATUS_NOT_IMPLEMENTED
The function is not implemented yet.
3.1.3 Function Documentation
3.1.3.1 murandCreateGenerator()
murandStatus_t MURANDAPI murandCreateGenerator (
murandGenerator_t ∗generator,
murandRngType_trng_type)
Creates a new random number generator.
Creates a new random number generator of typerng_typeand returns it ingenerator.
Supportedrng_typeas follows:
- MURAND_RNG_PSEUDO_XORWOW
- MURAND_RNG_PSEUDO_MRG32K3A
- MURAND_RNG_PSEUDO_MTGP
- MURAND_RNG_PSEUDO_PHILOX4_32_
- MURAND_RNG_QUASI_SOBOL
- MURAND_RNG_QUASI_SCRAMBLED_SOBOL
- MURAND_RNG_QUASI_SOBOL
- MURAND_RNG_QUASI_SCRAMBLED_SOBOL
Parameters generator Pointer to generator. rng_type Type of generator to create.
Return values MURAND_STATUS_SUCCESS muRAND successfully created the generator. MURAND_STATUS_ALLOCATION_FAILED Failed to allocate memory. MURAND_STATUS_VERSION_MISMATCH The header file version and the dynamically linked library version are not match. MURAND_STATUS_TYPE_ERROR The value ofrng_typeis invalid.
3.1.3.2 murandCreatePoissonDistribution()
murandStatus_t MURANDAPI murandCreatePoissonDistribution (
double lambda,
murandDiscreteDistribution_t ∗discrete_distribution)
Constructs the histogram of the Poisson distribution.
Constructs the histogram of the Poisson distribution with lambdalambda.
Parameters
lambda - lambda for the Poisson distribution.
discrete_distribution - Pointer to the histogram in device memory.
Return values
MURAND_STATUS_SUCCESS - If the histogram was constructed successfully.
MURAND_STATUS_ALLOCATION_FAILED - If memory could not be allocated.
MURAND_STATUS_OUT_OF_RANGE - If discrete_distribution pointer was null.
MURAND_STATUS_OUT_OF_RANGE - If lambda is non-positive.
3.1.3.3 murandDestroyDistribution()
murandStatus_t MURANDAPI murandDestroyDistribution (
murandDiscreteDistribution_tdiscrete_distribution)
Destroys the histogram array for the discrete distribution.
Destroys the histogram array for the discrete distribution created by murandCreatePoissonDistribution().
Parameters
discrete_distribution - Pointer to the histogram in device memory.
Return values
MURAND_STATUS_OUT_OF_RANGE - Ifdiscrete_distributionwas null.
MURAND_STATUS_SUCCESS - If the histogram was destroyed successfully.
3.1.3.4 murandDestroyGenerator()
murandStatus_t MURANDAPI murandDestroyGenerator (
murandGenerator_tgenerator)
Destroys the specified generator.
Destroys a random number generator and frees related memory.
Parameters
generator - Generator to be destroyed.
Return values
MURAND_STATUS_SUCCESS muRAND successfully destroyed the generator.
MURAND_STATUS_NOT_CREATED The generator was not created.
3.1.3.5 murandGenerate()
murandStatus_t MURANDAPI murandGenerate (
murandGenerator_tgenerator,
unsigned int ∗output_data,
size_tn)
Generates uniformly distributed 32-bit unsigned integers.
Generatesnuniformly distributed 32-bit unsigned integers and saves them tooutput_data.
The numbers are between 0 and 2 ∧ 32 , including 0 and excluding 2 ∧ 32.
Parameters
generator - Generator to use.
output_data - Pointer to memory that stores generated numbers.
n - Number of 32-bit unsigned integers to generate.
Return values
MURAND_STATUS_SUCCESS - If random numbers were successfully generated.
MURAND_STATUS_NOT_CREATED - If the generator was not created.
Return values
MURAND_STATUS_LAUNCH_FAILURE - If a MUSA kernel launch failed.
MURAND_STATUS_LENGTH_NOT_MULTIPLE - If n is not a multiple of the dimension of the used
quasi-random generator.
3.1.3.6 murandGenerateLogNormal()
murandStatus_t MURANDAPI murandGenerateLogNormal (
murandGenerator_tgenerator,
float ∗output_data,
size_tn,
float mean,
float stddev)
Generates log-normally distributed float values.
Generatesnlog-normally distributed 32-bit floating-point values and saves them tooutput_data.
Parameters
generator - Generator to use.
output_data - Pointer to memory that stores generated numbers.
n - Number of floats to generate.
mean - The mean value of log-normal distribution.
stddev - The standard deviation value of log-normal distribution.
Return values
MURAND_STATUS_SUCCESS - If random numbers were successfully generated.
MURAND_STATUS_NOT_CREATED - If the generator was not created.
MURAND_STATUS_LAUNCH_FAILURE - If a MUSA kernel launch failed.
MURAND_STATUS_LENGTH_NOT_MULTIPLE - If n is not a multiple of the dimension of used quasi-random generator.
3.1.3.7 murandGenerateLogNormalDouble()
murandStatus_t MURANDAPI murandGenerateLogNormalDouble (
murandGenerator_t 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 that stores generated numbers.
n - Number of doubles to generate.
mean - The mean value of log-normal distribution.
stddev - The standard deviation value of log-normal distribution.
Return values
MURAND_STATUS_SUCCESS - If random numbers were successfully generated.
MURAND_STATUS_NOT_CREATED - If the generator was not created.
MURAND_STATUS_LAUNCH_FAILURE - If a MUSA kernel launch failed.
MURAND_STATUS_LENGTH_NOT_FAILURE - If n is not a multiple of the dimension of the used quasi-random generator.
3.1.3.8 murandGenerateLongLong()
murandStatus_t MURANDAPI murandGenerateLongLong (
murandGenerator_t 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.
The numbers are between 0 and 2 ∧ 64 , including 0 and excluding 2 ∧ 64.
Parameters
generator - Generator to use.
output_data - Pointer to memory that stores generated numbers.
n - Number of 64-bit unsigned integers to generate.
Return values
MURAND_STATUS_SUCCESS - If random numbers were successfully generated.
MURAND_STATUS_NOT_CREATED - If the generator was not created.
MURAND_STATUS_LAUNCH_FAILURE - If a MUSA kernel launch failed.
MURAND_STATUS_LENGTH_NOT_FAILURE - If n is not a multiple of the dimension of the used quasi-random generator.
MURAND_TYPE_ERROR - If the generator cannot generate 64-bit random numbers locally.
3.1.3.9 murandGenerateNormal()
murandStatus_t MURANDAPI murandGenerateNormal (
murandGenerator_t 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 that stores generated numbers.
n - Number of floats to generate.
mean - The mean value of the normal distribution.
stddev - The standard deviation value of the normal distribution.
Return values
MURAND_STATUS_SUCCESS - If random numbers were successfully generated.
MURAND_STATUS_NOT_CREATED - If the generator was not created.
MURAND_STATUS_LAUNCH_FAILURE - If a MUSA kernel launch failed.
MURAND_STATUS_LENGTH_NOT_MULTIPLE - If n is not a multiple of the dimension of the used quasi-random generator.
3.1.3.10 murandGenerateNormalDouble()
murandStatus_t MURANDAPI murandGenerateNormalDouble (
murandGenerator_t 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 that stores generated numbers.
n - Number of doubles to generate.
mean - The mean value of the normal distribution.
stddev - The standard deviation value of the normal distribution.
Return values
MURAND_STATUS_SUCCESS - If random numbers were successfully generated.
MURAND_STATUS_NOT_CREATED - If the generator was not created.
MURAND_STATUS_LAUNCH_FAILURE - If a MUSA kernel launch failed.
MURAND_STATUS_LENGTH_NOT_MULTIPLE - If n is not a multiple of the dimension of the used
quasi-random generator.
3.1.3.11 murandGeneratePoisson()
murandStatus_t MURANDAPI murandGeneratePoisson (
murandGenerator_t 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 that stores generated numbers.
n - Number of 32-bit unsigned integers to generate.
lambda - The lambda of the Poisson distribution.
Return values
MURAND_STATUS_SUCCESS - If random numbers were successfully generated.
MURAND_STATUS_NOT_CREATED - If the generator was not created.
MURAND_STATUS_LAUNCH_FAILURE - If a MUSA kernel launch failed.
MURAND_STATUS_OUT_OF_RANGE - If lambda is non-positive.
MURAND_STATUS_LENGTH_NOT_FAILURE - If n is not a multiple of the dimension of the used quasi-random generator.
3.1.3.12 murandGenerateSeeds()
murandStatus_t MURANDAPI murandGenerateSeeds (
murandGenerator_t generator)
Setup starting states.
Initializes the state of the generator on GPU or host. Users do not need to call this function before using a generator.
If murand_initialize() was not called for a generator, it will be automatically called by a function that generates random numbers (such as murandGenerate(), etc.).
Parameters
generator - Generator to initialize.
Return values
MURAND_STATUS_SUCCESS - If the seeds were generated successfully.
MURAND_STATUS_NOT_CREATED - If the generator was not created.
MURAND_STATUS_LAUNCH_FAILURE - If a MUSA kernel launch failed.
3.1.3.13 murandGenerateUniform()
murandStatus_t MURANDAPI murandGenerateUniform (
murandGenerator_t 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.
The 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 that stores generated numbers.
n - Number of floats to generate.
Return values
MURAND_STATUS_SUCCESS - If random numbers were successfully generated.
MURAND_STATUS_NOT_CREATED - If the generator was not created.
MURAND_STATUS_LAUNCH_FAILURE - If a MUSA kernel launch failed.
MURAND_STATUS_LENGTH_NOT_FAILURE - If n is not a multiple of the dimension of the used quasi-random generator.
3.1.3.14 murandGenerateUniformDouble()
murandStatus_t MURANDAPI murandGenerateUniformDouble (
murandGenerator_t 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.
The 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 that stores generated numbers.
n - Number of doubles to generate.
Return values
MURAND_STATUS_SUCCESS - If random numbers were successfully generated.
MURAND_STATUS_NOT_CREATED - If the generator was not created.
MURAND_STATUS_LAUNCH_FAILURE - If a MUSA kernel launch failed.
MURAND_STATUS_LENGTH_NOT_FAILURE - If n is not a multiple of the dimension of the used quasi-random generator.
3.1.3.15 murandGetDirectionVectors32()
murandStatus_t MURANDAPI murandGetDirectionVectors32 (
murandDirectionVectors32_t ∗vectors[],
murandDirectionVectorSet_t set )
Gets the direction vector used to generate a 32-bit quasi-random number.
Gets a pointer to an array of direction vectors that can be used to generate quasirandom number. The resulting pointer will reference an array of direction vectors in host memory.
The array contains vectors with multiple dimensions. Each dimension has 32 vectors. Each vector is an unsigned int.
Supported values of set as follows:
- MURAND_DIRECTION_VECTORS_32_JOEKUO6 (20,000 dimensions).
- MURAND_SCRAMBLED_DIRECTION_VECTORS_32_JOEKUO6 (20,000 dimensions).
Parameters
vectors - Address of pointer in which to return direction vectors.
set - Set of direction vectors to use.
Return values
MURAND_STATUS_SUCCESS - If the pointer was set successfully.
MURAND_STATUS_OUT_OF_RANGE - If the choice of set is invalid.
3.1.3.16 murandGetDirectionVectors64()
murandStatus_t MURANDAPI murandGetDirectionVectors64 (
murandDirectionVectors64_t ∗vectors[],
murandDirectionVectorSet_tset )
Gets direction vectors for 64-bit quasirandom number generation.
Gets a pointer to an array of direction vectors that can be used to generate quasirandom number. The resulting pointer will reference an array of direction vectors in host memory.
The array contains vectors with multiple dimensions. Each dimension has 64 vectors. Each individual vector is an unsigned long long.
Supported values of set as follows:
- MURAND_DIRECTION_VECTORS_64_JOEKUO6 (20,000 dimensions).
- MURAND_SCRAMBLED_DIRECTION_VECTORS_64_JOEKUO6 (20,000 dimensions).
Parameters
vectors - Address of pointer in which to return direction vectors.
set - Set of direction vectors to use.
Return values
MURAND_STATUS_OUT_OF_RANGE - If the choice of set is invalid.
MURAND_STATUS_SUCCESS - If the pointer was set successfully.
3.1.3.17 murandGetScrambleConstants32()
murandStatus_t MURANDAPI murandGetScrambleConstants32 (
unsigned int ∗∗constants)
Gets scramble constants for 32-bit scrambled Sobol'.
Gets a pointer to an array of scramble constants that can be used to generate quasirandom number. The resulting pointer will reference an array of unsinged ints in host memory.
The array contains vectors with multiple dimensions. Each dimension has a single unsigned int constant.
Parameters
constants - Address of pointer in which to return scramble constants.
Return values
MURAND_STATUS_SUCCESS - If the pointer was set successfully.
3.1.3.18 murandGetScrambleConstants64()
murandStatus_t MURANDAPI murandGetScrambleConstants64 (
unsigned long long∗∗constants)
Gets scramble constants for 64-bit scrambled Sobol'.
Gets a pointer to an array of scramble constants that can be used to generate quasirandom number. The resulting pointer will reference an array of unsinged long longs in host memory.
The array contains constants with multiple dimensions. Each dimension has a single unsigned long long constant.
Parameters
constants - Address of pointer in which to return scramble constants.
Return values
MURAND_STATUS_SUCCESS - If the pointer was set successfully.
3.1.3.19 murandGetVersion()
murandStatus_t MURANDAPI murandGetVersion (
int ∗version )
Returns the version of the library.
Returns in version the version of the dynamically linked muRAND library.
Parameters
version - The version of the library.
Return values
MURAND_STATUS_OUT_OF_RANGE - If version is NULL. MURAND_STATUS_SUCCESS - If the version was returned successfully.
3.1.3.20 murandSetGeneratorOffset()
murandStatus_t MURANDAPI murandSetGeneratorOffset (
murandGenerator_t generator,
unsigned long long offset)
Sets the offset of the random number generator. Sets the absolute offset of the random number generator. This function will reset the internal state of the generator, but will not change the seed of the generator. Note that the absolute offset cannot be set if the type of generator is MURAND_RNG_PSEUDO_MTGP32.
Parameters
generator - Random number generator.
offset - New absolute offset.
Return values
MURAND_STATUS_SUCCESS - If offset was set successfully.
MURAND_STATUS_NOT_CREATED - If the generator was not created.
MURAND_STATUS_TYPE_ERROR - If the generator's type is MURAND_RNG_PSEUDO_MTGP32.
3.1.3.21 murandSetGeneratorOrdering()
murandStatus_t MURANDAPI murandSetGeneratorOrdering (
murandGenerator_t generator,
murandOrdering_t order)
Sets the order of the random number generator.
Sets the ordering of random number generator results. This function will reset the internal state of the generator, but will not change the seed of the generator.
Parameters
generator - Random number generator.
order - New ordering of results.
The ordering choices for pseudorandom sequences are MURAND_ORDERING_PSEUDO_DEFAULT and MURAND_ORDERING_PSEUDO_LEGACY. The default ordering is MURAND_ORDERING_PSEUDO_DEFAULT, which is currently equal to MURAND_ORDERING_PSEUDO_LEGACY.
For quasirandom sequences, there is only one ordering MURAND_ORDERING_QUASI_DEFAULT.
Return values
MURAND_STATUS_SUCCESS - If the ordering was set successfully.
MURAND_STATUS_NOT_CREATED - If the generator was not created.
MURAND_STATUS_OUT_OF_RANGE - If the ordering is not valid.
MURAND_STATUS_TYPE_ERROR - If the type of generator is not valid.
3.1.3.22 murandSetPseudoRandomGeneratorSeed()
murandStatus_t MURANDAPI murandSetPseudoRandomGeneratorSeed (
murandGenerator_t generator,
unsigned long long seed)
Sets the seed of the pseudo-random number generator.
This function will reset the internal state of the generator, but will not change the offset of the generator.
For the MRG32K3a generator, the seed value cannot be zero. If seed is equal to zero and the typr of the generator
is MURAND_RNG_PSEUDO_MRG32K3A, then 12345 will be used as the seed value.
Parameters
generator - Pseudo-random number generator.
seed - The value of seed.
Return values
MURAND_STATUS_SUCCESS - If seed was set successfully.
MURAND_STATUS_NOT_CREATED - If the generator was not created.
MURAND_STATUS_TYPE_ERROR - If the generator is a quasi-random number generator.
3.1.3.23 murandSetQuasiRandomGeneratorDimensions()
murandStatus_t MURANDAPI murandSetQuasiRandomGeneratorDimensions (
murandGenerator_t generator,
unsigned int dimensions)
Sets the number of dimensions of a quasi-random number generator.
Sets the number of dimensions of a quasi-random number generator. Supported values of dimensions are 1 to
20000.
This function will reset the internal state of the generator, but will not change the offset of the generator.
Parameters
generator - Quasi-random number generator.
dimensions - Number of dimensions.
Return values
MURAND_STATUS_SUCCESS - If the number of dimensions was set successfully.
MURAND_STATUS_NOT_CREATED - If the generator was not created.
MURAND_STATUS_TYPE_ERROR - If the generator is not a quasi-random number generator.
MURAND_STATUS_OUT_OF_RANGE - If dimensions is out of range.
3.1.3.24 murandSetStream()
murandStatus_t MURANDAPI murandSetStream (
murandGenerator_t generator,
MUstream 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 until set again.
Parameters
generator - Generator to modify.
stream - Stream to use or NULL for default stream.
Return values
MURAND_STATUS_SUCCESS - If stream was set successfully.
MURAND_STATUS_NOT_CREATED - If the generator was not created.
3.2 Device API
Macros
- #define MURAND_MRG32K3A_DEFAULT_SEED 12345ULL Default seed for MRG32K3A PRNG.
- #define MURAND_PHILOX4x32_DEFAULT_SEED 0xdeadbeefdeadbeefULL Default seed for PHILOX4x32 PRNG.
- #define FQUALIFIERS forceinline device
- #define MURAND_XORWOW_DEFAULT_SEED 0ULL Default seed for XORWOW PRNG.
Functions
-
FQUALIFIERS float murand_log_normal (murandStatePhilox4_32_10_t ∗state, float mean, float stddev)
Returns a log-normally distributed
floatvalue. -
FQUALIFIERS double murand_log_normal_double (murandStatePhilox4_32_10_t ∗state, double mean, dou ble stddev)
Returns a log-normally distributed
doublevalues. -
FQUALIFIERS float murand_log_normal (murandStateMRG32k3a_t ∗state, float mean, float stddev)
Returns a log-normally distributed
floatvalue. -
FQUALIFIERS double murand_log_normal_double (murandStateMRG32k3a_t ∗state, double mean, double stddev)
Returns a log-normally distributed
doublevalue. -
FQUALIFIERS float murand_log_normal (murandStateXORWOW_t ∗state, float mean, float stddev)
Returns a log-normally distributed
floatvalue. -
FQUALIFIERS double murand_log_normal_double (murandStateXORWOW_t ∗state, double mean, double stddev)
Returns a log-normally distributed
doublevalue. -
FQUALIFIERS float murand_log_normal (murandStateMtgp32_t ∗state, float mean, float stddev)
Returns a log-normally distributed
floatvalue. -
FQUALIFIERS double murand_log_normal_double (murandStateMtgp32_t ∗state, double mean, double stddev)
Returns a log-normally distributed
doublevalue. -
FQUALIFIERS float murand_log_normal (murandStateSobol32_t ∗state, float mean, float stddev)
Returns a log-normally distributed
floatvalue. -
FQUALIFIERS double murand_log_normal_double (murandStateSobol32_t ∗state, double mean, double stddev)
Returns a log-normally distributed
doublevalue. -
FQUALIFIERS float murand_log_normal (murandStateScrambledSobol32_t ∗state, float mean, float stddev)
Returns a log-normally distributed
floatvalue. -
FQUALIFIERS double murand_log_normal_double (murandStateScrambledSobol32_t ∗state, double mean, double stddev)
Returns a log-normally distributed
doublevalue. -
FQUALIFIERS float murand_log_normal (murandStateSobol64_t ∗state, float mean, float stddev)
Returns a log-normally distributed
floatvalue. -
FQUALIFIERS double murand_log_normal_double (murandStateSobol64_t ∗state, double mean, double stddev)
Returns a log-normally distributed
doublevalue. -
FQUALIFIERS float murand_log_normal (murandStateScrambledSobol64_t ∗state, float mean, float stddev)
Returns a log-normally distributed
floatvalue. -
FQUALIFIERS double murand_log_normal_double (murandStateScrambledSobol64_t ∗state, double mean, double stddev)
Returns a log-normally distributed
doublevalue. -
FQUALIFIERS void murand_init (const unsigned long long seed, const unsigned long long subsequence, const unsigned long long offset, murandStateMRG32k3a_t ∗state)
Initializes MRG32K3A state.
-
FQUALIFIERS unsigned int murand (murandStateMRG32k3a_t ∗state)
Returns uniformly distributed random
unsignedintvalue. -
host murandStatus_t murandMakeMTGP32KernelState (murandStateMtgp32_t ∗d_state, mtgp32_params_fast_t params[ ], int n, unsigned long long seed)
Initializes MTGP32 states.
-
FQUALIFIERS unsigned int murand (murandStateMtgp32_t ∗state)
Returns uniformly distributed random
unsignedintvalue. -
FQUALIFIERS float murand_normal (murandStatePhilox4_32_10_t ∗state)
Returns a normally distributed
floatvalue. -
FQUALIFIERS float4 murand_normal4 (murandStatePhilox4_32_10_t ∗state)
Returns four normally distributed
floatvalues. -
FQUALIFIERS double murand_normal_double (murandStatePhilox4_32_10_t ∗state)
Returns a normally distributed
doublevalue. -
FQUALIFIERS double2 murand_normal2_double (murandStatePhilox4_32_10_t ∗state)
Returns two normally distributed
doublevalues. -
FQUALIFIERS float murand_normal (murandStateMRG32k3a_t ∗state)
Returns a normally distributed
floatvalue. -
FQUALIFIERS double murand_normal_double (murandStateMRG32k3a_t ∗state)
Returns a normally distributed
doublevalue. -
FQUALIFIERS double2 murand_normal2_double (murandStateMRG32k3a_t ∗state)
Returns two normally distributed
doublevalues. -
FQUALIFIERS float murand_normal (murandStateXORWOW_t ∗state)
Returns a normally distributed
floatvalue. -
FQUALIFIERS double murand_normal_double (murandStateXORWOW_t ∗state)
Returns a normally distributed
doublevalue. -
FQUALIFIERS double2 murand_normal2_double (murandStateXORWOW_t ∗state)
Returns two normally distributed
doublevalues. -
FQUALIFIERS float murand_normal (murandStateMtgp32_t ∗state)
Returns a normally distributed
floatvalue. -
FQUALIFIERS double murand_normal_double (murandStateMtgp32_t ∗state)
Returns a normally distributed
doublevalue. -
FQUALIFIERS float murand_normal (murandStateSobol32_t ∗state)
Returns a normally distributed
floatvalue. -
FQUALIFIERS double murand_normal_double (murandStateSobol32_t ∗state)
Returns a normally distributed
doublevalue. -
FQUALIFIERS float murand_normal (murandStateScrambledSobol32_t ∗state)
Returns a normally distributed
floatvalue. -
FQUALIFIERS double murand_normal_double (murandStateScrambledSobol32_t ∗state)
Returns a normally distributed
doublevalue. -
FQUALIFIERS float murand_normal (murandStateSobol64_t ∗state)
Returns a normally distributed
floatvalue. -
FQUALIFIERS double murand_normal_double (murandStateSobol64_t ∗state)
Returns a normally distributed
doublevalue. -
FQUALIFIERS float murand_normal (murandStateScrambledSobol64_t ∗state)
Returns a normally distributed
floatvalue. -
FQUALIFIERS double murand_normal_double (murandStateScrambledSobol64_t ∗state)
Returns a normally distributed
doublevalue. -
FQUALIFIERS void murand_init (const unsigned long long seed, const unsigned long long subsequence, const unsigned long long offset, murandStatePhilox4_32_10_t ∗state)
Initializes Philox state.
-
FQUALIFIERS unsigned int murand (murandStatePhilox4_32_10_t ∗state)
Returns uniformly distributed random
unsignedintvalue. -
FQUALIFIERS uint4 murand4 (murandStatePhilox4_32_10_t ∗state)
Returns four uniformly distributed random
unsignedintvalues. -
FQUALIFIERS unsigned int murand_poisson (murandStatePhilox4_32_10_t ∗state, double lambda)
Returns a Poisson-distributed
unsignedintusing the Philox generator. -
FQUALIFIERS unsigned int murand_poisson (murandStateMRG32k3a_t ∗state, double lambda)
Returns a Poisson-distributed
unsignedintusing the MRG32k3a generator. -
FQUALIFIERS unsigned int murand_poisson (murandStateXORWOW_t ∗state, double lambda)
Returns a Poisson-distributed
unsignedintusing the XORWOW generator. -
FQUALIFIERS unsigned int murand_poisson (murandStateMtgp32_t ∗state, double lambda)
Returns a Poisson-distributed
unsignedintusing the MTGP32 generator. -
FQUALIFIERS unsigned int murand_poisson (murandStateSobol32_t ∗state, double lambda)
Returns a Poisson-distributed
unsignedintusing the SOBOL32 generator. -
FQUALIFIERS unsigned int murand_poisson (murandStateScrambledSobol32_t ∗state, double lambda)
Returns a Poisson-distributed
unsignedintusing the SCRAMBLED_SOBOL32 generator. -
FQUALIFIERS unsigned long long int murand_poisson (murandStateSobol64_t ∗state, double lambda)
Returns a Poisson-distributed
unsignedlonglongintusing the SOBOL64 generator. -
FQUALIFIERS unsigned long long int murand_poisson (murandStateScrambledSobol64_t ∗state, double lambda)
Returns a Poisson-distributed
unsignedlonglongintusing the SCRAMBLED_SOBOL64 generator. -
FQUALIFIERS void murand_init (const unsigned int ∗vectors, const unsigned int scramble_constant, const unsigned int offset, murandStateScrambledSobol32_t ∗state)
Initializes scrambled_sobol32 state.
-
FQUALIFIERS unsigned int murand (murandStateScrambledSobol32_t ∗state)
Returns uniformly distributed random
unsignedintvalue. -
FQUALIFIERS void murand_init (const unsigned long long int ∗vectors, const unsigned long long int scramble_constant, const unsigned int offset, murandStateScrambledSobol64_t ∗state)
Initializes scrambled_sobol64 state.
-
FQUALIFIERS unsigned long long int murand (murandStateScrambledSobol64_t ∗state)
Returns uniformly distributed random
unsignedintvalue. -
FQUALIFIERS void murand_init (const unsigned int ∗vectors, const unsigned int offset, murandStateSobol32_t ∗state)
Initializes SOBOL32 state.
-
FQUALIFIERS unsigned int murand (murandStateSobol32_t ∗state)
Returns uniformly distributed random
unsignedintvalue. -
FQUALIFIERS void murand_init (const unsigned long long int ∗vectors, const unsigned int offset, murandStateSobol64_t ∗state)
Initializes sobol64 state.
-
FQUALIFIERS unsigned long long int murand (murandStateSobol64_t ∗state)
Returns uniformly distributed random
unsignedintvalue. -
FQUALIFIERS float murand_uniform (murandStatePhilox4_32_10_t ∗state)
Returns a uniformly distributed random
floatvalue. -
FQUALIFIERS float4 murand_uniform4 (murandStatePhilox4_32_10_t ∗state)
Returns four uniformly distributed random
floatvalues. -
FQUALIFIERS double murand_uniform_double (murandStatePhilox4_32_10_t ∗state)
Returns a uniformly distributed random
doublevalue. -
FQUALIFIERS double2 murand_uniform2_double (murandStatePhilox4_32_10_t ∗state)
Returns two uniformly distributed random
doublevalues. -
FQUALIFIERS float murand_uniform (murandStateMRG32k3a_t ∗state)
Returns a uniformly distributed random
floatvalue. -
FQUALIFIERS double murand_uniform_double (murandStateMRG32k3a_t ∗state)
Returns a uniformly distributed random
doublevalue. -
FQUALIFIERS float murand_uniform (murandStateXORWOW_t ∗state)
Returns a uniformly distributed random
floatvalue. -
FQUALIFIERS double murand_uniform_double (murandStateXORWOW_t ∗state)
Returns a uniformly distributed random
doublevalue. -
FQUALIFIERS float murand_uniform (murandStateMtgp32_t ∗state)
Returns a uniformly distributed random
floatvalue. -
FQUALIFIERS double murand_uniform_double (murandStateMtgp32_t ∗state)
Returns a uniformly distributed random
doublevalue. -
FQUALIFIERS float murand_uniform (murandStateSobol32_t ∗state)
Returns a uniformly distributed random
floatvalue. -
FQUALIFIERS double murand_uniform_double (murandStateSobol32_t ∗state)
Returns a uniformly distributed random
doublevalue. -
FQUALIFIERS float murand_uniform (murandStateScrambledSobol32_t ∗state)
Returns a uniformly distributed random
floatvalue. -
FQUALIFIERS double murand_uniform_double (murandStateScrambledSobol32_t ∗state)
Returns a uniformly distributed random
doublevalue. -
FQUALIFIERS float murand_uniform (murandStateSobol64_t ∗state)
Returns a uniformly distributed random
floatvalue. -
FQUALIFIERS double murand_uniform_double (murandStateSobol64_t ∗state)
Returns a uniformly distributed random
doublevalue. -
FQUALIFIERS float murand_uniform (murandStateScrambledSobol64_t ∗state)
Returns a uniformly distributed random
floatvalue. -
FQUALIFIERS double murand_uniform_double (murandStateScrambledSobol64_t ∗state)
Returns a uniformly distributed random
doublevalue. -
FQUALIFIERS void murand_init (const unsigned long long seed, const unsigned long long subsequence, const unsigned long long offset, murandStateXORWOW_t ∗state)
Initializes XORWOW state.
-
FQUALIFIERS unsigned int murand (murandStateXORWOW_t ∗state)
Returns uniformly distributed random
unsignedintvalue.
3.2.1 Detailed Description
This section describes muRAND device API.
3.2.2 Function Documentation
3.2.2.1 murand()[1/8]
FQUALIFIERS unsigned int murand (
murandStateMRG32k3a_t ∗state)
Returns uniformly distributed random unsigned int value.
Generates and returns uniformly distributed random unsigned int value from [0; 2∧32 - 1] range using
MRG32K3A generator in state. The state is incremented by one position.
Parameters
state - Pointer to a state to use.
Returns
Pseudorandom value (32-bit) as an unsigned int.
3.2.2.2 murand()[2/8]
FQUALIFIERS unsigned int murand (
murandStateMtgp32_t ∗state)
Returns uniformly distributed random unsigned int value.
Generates and returns uniformly distributed random unsigned int value from [0; 2∧32 - 1] range using
MTGP32 generator in state. The state is incremented by one position.
Parameters
state - Pointer to a state to use.
Returns
Pseudorandom value (32-bit) as an unsigned int.
3.2.2.3 murand()[3/8]
FQUALIFIERS unsigned int murand (
murandStatePhilox4_32_10_t ∗state)
Returns uniformly distributed random unsigned int value.
Generates and returns uniformly distributed random unsigned int value from [0; 2∧32 - 1] range using Philox
generator in state. The state is incremented by one position.
Parameters
state - Pointer to a state to use.
Returns
Pseudorandom value (32-bit) as an unsigned int.
3.2.2.4 murand()[4/8]
FQUALIFIERS unsigned int murand (
murandStateScrambledSobol32_t ∗state)
Returns uniformly distributed random unsigned int value.
Generates and returns uniformly distributed random unsigned int value from [0; 2∧32 - 1] range using scrambled_sobol32 generator in state. The state is incremented by one position.
Parameters
state - Pointer to a state to use.
Returns
Quasirandom value (32-bit) as an unsigned int.
3.2.2.5 murand()[5/8]
FQUALIFIERS unsigned long long int murand (
murandStateScrambledSobol64_t ∗state)
Returns uniformly distributed random unsigned int value.
Generates and returns uniformly distributed random unsigned int value from [0; 2∧64 - 1] range using
scrambled_sobol64 generator in state. The state is incremented by one position.
Parameters
state - Pointer to a state to use.
Returns
Quasirandom value (64-bit) as an unsigned int.
3.2.2.6 murand()[6/8]
FQUALIFIERS unsigned int murand (
murandStateSobol32_t ∗state)
Returns uniformly distributed random unsigned int value.
Generates and returns uniformly distributed random unsigned int value from [0; 2∧32 - 1] range using Sobol32
generator in state. The state is incremented by one position.
Parameters
state - Pointer to a state to use.
Returns
Quasirandom value (32-bit) as an unsigned int.
3.2.2.7 murand()[7/8]
FQUALIFIERS unsigned long long int murand (
murandStateSobol64_t ∗state)
Returns uniformly distributed random unsigned int value.
Generates and returns uniformly distributed random unsigned int value from [0; 2∧64 - 1] range using sobol64
generator in state. The state is incremented by one position.
Parameters
state - Pointer to a state to use.
Returns
Quasirandom value (64-bit) as an unsigned int.
3.2.2.8 murand()[8/8]
FQUALIFIERS unsigned int murand (
murandStateXORWOW_t ∗state)
Returns uniformly distributed random unsigned int value.
Generates and returns uniformly distributed random unsigned int value from [0; 2∧32 - 1] range using XORWOW generator in state. The state is incremented by one position.
Parameters
state - Pointer to a state to use.
Returns
Pseudorandom value (32-bit) as an unsigned int.
3.2.2.9 murand4()
FQUALIFIERS uint4 murand4 (
murandStatePhilox4_32_10_t ∗state)
Returns four uniformly distributed random unsigned int values.
Generates and returns four uniformly distributed random unsigned int values from [0; 2∧32 - 1] range using Philox generator in state. The state is incremented by four positions.
Parameters
state - Pointer to a state to use.
Returns
Four pseudorandom values (32-bit) as an uint4.
3.2.2.10 murand_init()[1/7]
FQUALIFIERS void murand_init (
const unsigned int ∗vectors,
const unsigned int offset,
murandStateSobol32_t ∗state)
Initializes 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.
3.2.2.11 murand_init()[2/7]
FQUALIFIERS void murand_init (
const unsigned int ∗vectors,
const unsigned int scramble_constant,
const unsigned int offset,
murandStateScrambledSobol32_t ∗state)
Initializes scrambled_sobol32 state.
Initializes the scrambled_sobol32 generator state with the given direction vectors and offset.
Parameters
vectors - Direction vectors.
scramble_constant - The constant is used to scramble the sequence.
offset - Absolute offset into sequence.
state - Pointer to state to initialize.
3.2.2.12 murand_init()[3/7]
FQUALIFIERS void murand_init (
const unsigned long long int ∗vectors,
const unsigned int offset,
murandStateSobol64_t ∗state)
Initializes 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.
3.2.2.13 murand_init()[4/7]
FQUALIFIERS void murand_init (
const unsigned long long int ∗vectors,
const unsigned long long int scramble_constant,
const unsigned int offset,
murandStateScrambledSobol64_t ∗state)
Initializes scrambled_sobol64 state.
Initializes the scrambled_sobol64 generator state with the given direction vectors and offset.
Parameters
vectors - Direction vectors.
scramble_constant - The constant is used to scramble the sequence.
offset - Absolute offset into sequence.
state - Pointer to state to initialize.
3.2.2.14 murand_init()[5/7]
FQUALIFIERS void murand_init (
const unsigned long long seed,
const unsigned long long subsequence,
const unsigned long long offset,
murandStateMRG32k3a_t ∗state)
Initializes MRG32K3A state.
Initializes the MRG32K3A generator state with the given seed, subsequence, and offset.
Parameters
seed - Value for use as a seed.
subsequence - Subsequence to start at.
offset - Absolute offset into subsequence.
state - Pointer to state to initialize.
3.2.2.15 murand_init()[6/7]
FQUALIFIERS void murand_init (
const unsigned long long seed,
const unsigned long long subsequence,
const unsigned long long offset,
murandStatePhilox4_32_10_t ∗state)
Initializes Philox state.
Initializes the Philox generator state with the given seed, subsequence, and offset.
Parameters
seed - Value for use as a seed.
subsequence - Subsequence to start at.
offset - Absolute offset into subsequence.
state - Pointer to state to initialize.
3.2.2.16 murand_init()[7/7]
FQUALIFIERS void murand_init (
const unsigned long long seed,
const unsigned long long subsequence,
const unsigned long long offset,
murandStateXORWOW_t ∗state)
Initializes XORWOW state.
Initializes the XORWOW generator state with the given seed, subsequence, and offset.
Parameters
seed - Value for use as a seed.
subsequence - Subsequence to start at.
offset - Absolute offset into subsequence.
state - Pointer to state to initialize.
3.2.2.17 murand_log_normal()[1/8]
FQUALIFIERS float murand_log_normal (
murandStateMRG32k3a_t ∗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. This function generates two normally distributed values using the Box-Muller transform method, transforms them to log-normally distributed values, returns the first one, and saves the second to be returned on the subsequent call.
Parameters
state - Pointer to a state to use.
mean - Mean of the related log-normal distribution.
stddev - The standard deviation of the related log-normal distribution.
Returns
Log-normally distributed float value.
3.2.2.18 murand_log_normal()[2/8]
FQUALIFIERS float murand_log_normal (
murandStateMtgp32_t ∗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 the position of the generator by one.
Parameters
state - Pointer to a state to use.
mean - Mean of the related log-normal distribution.
stddev - The standard deviation of the related log-normal distribution.
Returns
Log-normally distributed float value.
3.2.2.19 murand_log_normal()[3/8]
FQUALIFIERS float murand_log_normal (
murandStatePhilox4_32_10_t ∗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. This function generates two normally distributed values using the Box-Muller transform method, transforms them to log-normally distributed values, returns the first one, and saves the second to be returned on the subsequent call.
Parameters
state - Pointer to a state to use.
mean - Mean of the related log-normal distribution.
stddev - The standard deviation of the related log-normal distribution.
Returns
Log-normally distributed float value.
3.2.2.20 murand_log_normal()[4/8]
FQUALIFIERS float murand_log_normal (
murandStateScrambledSobol32_t ∗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 the position of the generator by one.
Parameters
state - Pointer to a state to use.
mean - Mean of the related log-normal distribution.
stddev - The standard deviation of the related log-normal distribution.
Returns
Log-normally distributed float value.
3.2.2.21 murand_log_normal()[5/8]
FQUALIFIERS float murand_log_normal (
murandStateScrambledSobol64_t ∗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 the position of the generator by one.
Parameters
state - Pointer to a state to use.
mean - Mean of the related log-normal distribution.
stddev - The standard deviation of the related log-normal distribution.
Returns
Log-normally distributed float value.
3.2.2.22 murand_log_normal()[6/8]
FQUALIFIERS float murand_log_normal (
murandStateSobol32_t ∗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 the position of the generator by one.
Parameters
state - Pointer to a state to use.
mean - Mean of the related log-normal distribution.
stddev - The standard deviation of the related log-normal distribution.
Returns
Log-normally distributed float value.
3.2.2.23 murand_log_normal()[7/8]
FQUALIFIERS float murand_log_normal (
murandStateSobol64_t ∗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 the position of the generator by one.
Parameters
state - Pointer to a state to use.
mean - Mean of the related log-normal distribution.
stddev - The standard deviation of the related log-normal distribution.
Returns
Log-normally distributed float value.
3.2.2.24 murand_log_normal()[8/8]
FQUALIFIERS float murand_log_normal (
murandStateXORWOW_t ∗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. This function generates two normally distributed values using the Box-Muller transform, transforms them to log-normally distributed values, returns the first one, and saves the second to be returned on the subsequent call.
Parameters
state - Pointer to a state to use.
mean - Mean of the related log-normal distribution.
stddev - The standard deviation of the related log-normal distribution.
Returns
Log-normally distributed float value.
3.2.2.25 murand_log_normal_double()[1/8]
FQUALIFIERS double murand_log_normal_double (
murandStateMRG32k3a_t ∗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. This function generates two normally distributed double values using the Box-Muller transform method, transforms them to log-normally distributed double values, returns the first one, and saves the second to be returned on the subsequent call.
Parameters
state - Pointer to a state to use.
mean - Mean of the related log-normal distribution.
stddev - The standard deviation of the related log-normal distribution.
Returns
Log-normally distributed double value.
3.2.2.26 murand_log_normal_double()[2/8]
FQUALIFIERS double murand_log_normal_double (
murandStateMtgp32_t ∗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 the position of the generator by one.
Parameters
state - Pointer to a state to use.
mean - Mean of the related log-normal distribution.
stddev - The standard deviation of the related log-normal distribution.
Returns
Log-normally distributed double value.
3.2.2.27 murand_log_normal_double()[3/8]
FQUALIFIERS double murand_log_normal_double (
murandStatePhilox4_32_10_t ∗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. This function generates two normally distributed double values using the Box-Muller transform method, transforms them to log-normally distributed double values, returns the first one, and saves the second to be returned on the subsequent call.
Parameters
state - Pointer to a state to use.
mean - Mean of the related log-normal distribution.
stddev - The standard deviation of the related log-normal distribution.
Returns
Log-normally distributed double value.
3.2.2.28 murand_log_normal_double()[4/8]
FQUALIFIERS double murand_log_normal_double (
murandStateScrambledSobol32_t ∗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 the position of the generator by one.
Parameters
state - Pointer to a state to use.
mean - Mean of the related log-normal distribution.
stddev - The standard deviation of the related log-normal distribution.
Returns
Log-normally distributed double value.
3.2.2.29 murand_log_normal_double()[5/8]
FQUALIFIERS double murand_log_normal_double (
murandStateScrambledSobol64_t ∗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 the position of the generator by one.
Parameters
state - Pointer to a state to use.
mean - Mean of the related log-normal distribution.
stddev - The standard deviation of the related log-normal distribution.
Returns
Log-normally distributed double value.
3.2.2.30 murand_log_normal_double()[6/8]
FQUALIFIERS double murand_log_normal_double (
murandStateSobol32_t ∗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 the position of the generator by one.
Parameters
state - Pointer to a state to use.
mean - Mean of the related log-normal distribution.
stddev - The standard deviation of the related log-normal distribution.
Returns
Log-normally distributed double value.
3.2.2.31 murand_log_normal_double()[7/8]
FQUALIFIERS double murand_log_normal_double (
murandStateSobol64_t ∗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 the position of the generator by one.
Parameters
state - Pointer to a state to use.
mean - Mean of the related log-normal distribution.
stddev - The standard deviation of the related log-normal distribution.
Returns
Log-normally distributed double value.
3.2.2.32 murand_log_normal_double()[8/8]
FQUALIFIERS double murand_log_normal_double (
murandStateXORWOW_t ∗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 the position of the generator by two. This function generates two normally distributed double values using the Box-Muller transform method, transforms them to log-normally distributed double values, returns the first one, and saves the second to be returned on the subsequent call.
Parameters
state - Pointer to a state to use.
mean - Mean of the related log-normal distribution.
stddev - The standard deviation of the related log-normal distribution.
Returns
Log-normally distributed double value.
3.2.2.33 murand_normal()[1/8]
FQUALIFIERS float murand_normal (
murandStateMRG32k3a_t ∗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. The normal distribution used has a mean value equal to 0.0f, and a standard deviation equal to 1.0f. This function generates two normally distributed values using the Box-Muller transform method, returns the first one, and saves the second to be returned on the subsequent call.
Parameters
state - Pointer to a state to use.
Returns
Normally distributed float value.
3.2.2.34 murand_normal()[2/8]
FQUALIFIERS float murand_normal (
murandStateMtgp32_t ∗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. The normal distribution used has a mean value equal to 0.0f, and a standard deviation equal to 1.0f.
Parameters
state - Pointer to a state to use.
Returns
Normally distributed float value.
3.2.2.35 murand_normal()[3/8]
FQUALIFIERS float murand_normal (
murandStatePhilox4_32_10_t ∗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. The normal distribution used has a mean mean value equal to 0.0f, and a standard deviation equal to 1.0f. This function generates two normally distributed values using the Box-Muller transform method, returns the first one, and saves the second to be returned on the subsequent call.
Parameters
state - Pointer to a state to use.
Returns
Normally distributed float value.
3.2.2.36 murand_normal()[4/8]
FQUALIFIERS float murand_normal (
murandStateScrambledSobol32_t ∗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. The normal distribution used has a mean value equal to 0.0f, and a standard deviation equal to 1.0f.
Parameters
state - Pointer to a state to use.
Returns
Normally distributed float value.
3.2.2.37 murand_normal()[5/8]
FQUALIFIERS float murand_normal (
murandStateScrambledSobol64_t ∗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. The normal distribution used has a mean value equal to 0.0f, and a standard deviation equal to 1.0f.
Parameters
state - Pointer to a state to use.
Returns
Normally distributed float value.
3.2.2.38 murand_normal()[6/8]
FQUALIFIERS float murand_normal (
murandStateSobol32_t ∗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. The normal distribution used has a mean value equal to 0.0f, and a standard deviation equal to 1.0f.
Parameters
state - Pointer to a state to use.
Returns
Normally distributed float value.
3.2.2.39 murand_normal()[7/8]
FQUALIFIERS float murand_normal (
murandStateSobol64_t ∗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. The normal distribution used has a mean value equal to 0.0f, and a standard deviation equal to 1.0f.
Parameters
state - Pointer to a state to use.
Returns
Normally distributed float value.