generate#
Entry point to obtain random numbers from a given engine with proper statistics of a given distribution.
Description and Assumptions
oneapi::math::rng::generate function produces random numbers sequence from the given engine object and applied transformation from a given distribution object.
generate (Buffer version)#
Syntax
namespace oneapi::math::rng {
template<typename DistrType, typename EngineType>
void generate (const DistrType& distr, EngineType& engine, std::int64_t n, sycl::buffer<typename DistrType::result_type, 1>& r);
}
Template Parameters
- DistrType
Type of distribution which is used for random number generation.
- EngineType
Type of engine which is used for random number generation.
Input Parameters
- distr
Distribution object. See Host Distributions for details.
- engine
Engine object. See Host Engines (Basic Random Number Generators) for details.
- n
Number of random values to be generated.
Output Parameters
- r
sycl::buffer of generated values.
Throws
- oneapi::math::invalid_argument
Exception is thrown when n > r.get_count(), or n < 0
generate (USM version)#
Syntax
namespace oneapi::math::rng {
template<typename DistrType, typename EngineType>
sycl::event generate (const DistrType& distr, EngineType& engine, std::int64_t n, typename DistrType::result_type* r, const std::vector<sycl::event> & dependencies);
}
Template Parameters
- DistrType
Type of distribution which is used for random number generation.
- EngineType
Type of engine which is used for random number generation.
Input Parameters
- distr
Distribution object. See Host Distributions for details.
- engine
Engine object. See Host Engines (Basic Random Number Generators) for details.
- n
Number of random values to be generated.
- dependencies
Optional parameter. List of events to wait for before starting computation, if any.
Output Parameters
- r
pointer to generated values.
Throws
- oneapi::math::invalid_argument
Exception is thrown when r == nullptr, or n < 0
Return Value
Output event to wait on to ensure computation is complete.
Parent topic: Host Generate Routine