generate#

Description#

Entry point to obtain random numbers from a given engine with proper statistics of a given distribution.

API#

Syntax#

Buffer API

namespace oneapi::mkl::rng {
  template<typename Distr, typename Engine>
  void generate (const Distr& distr,
                 Engine& engine, std::int64_t n,
                 sycl::buffer<typename Distr::result_type, 1>& r)
}

USM API

namespace oneapi::mkl::rng {
  template<typename Distr, typename Engine>
  sycl::event generate (const Distr& distr,
                        Engine& engine, std::int64_t n,
                        typename Distr::result_type* r,
                        const std::vector<sycl::event> & dependencies)
}

Include Files#

  • oneapi/mkl/rng.hpp

Input Parameters#

Name

Type

Description

distr

const Distr&

Distribution object. See Distributions for details.

engine

Engine&

Engine object. See Engines for details.

n

std::int64_t

Number of random values to be generated.

Optional Input Parameter for USM API

Name

Type

Description

dependencies

const std::vector <sycl::event> &

List of events to wait for before starting computation, if any.

Output Parameters#

Buffer API

Name

Type

Description

r

sycl::buffer<typename Distr::result_type, 1>

sycl::buffer r to the output vector.

USM API

Name

Type

Description

r

typename Distr::result_type

Pointer r to the output vector.

event

sycl::event

Function return event after submitting task in sycl::queue from the engine.

generate submits a kernel into a queue that is held by the engine and fills sycl::buffer<typename sDistr::result_type> vector with n random numbers.