.. _oneapi-mkl-rng-uniform-continuous: oneapi::mkl::rng::uniform (Continuous) ====================================== Generates random numbers with uniform distribution. .. contents:: :local: :depth: 1 Description *********** The class object is used in ``oneapi::mkl::rng::generate`` function to provide random numbers uniformly distributed over the interval [``a``, ``b``), where ``a``, ``b`` are the left and right bounds of the interval, respectively, and ``a``, ``b∈R`` ; ``a`` < ``b``. The probability density function is given by: .. math:: F_{a, b}(x) = \begin{cases} \frac{1}{b-a}, & x \in [a, b)\\ 1, & x \notin [a, b) \end{cases}, -\infty < x < +\infty The cumulative distribution function is as follows: .. math:: F_{a, b}(x) = \begin{cases} 0, & x < a \\ \frac{x-a}{b-a}, & a \leq x < b \\ 1, & x \geq b \end{cases}, -\infty < x < +\infty API *** Syntax ------ .. code-block:: cpp template class uniform {public: using method_type = Method; using result_type = Type; uniform(): uniform(static_cast(0.0), static_cast(1.0)); explicit uniform(Type a, Type b); explicit uniform(const param_type& pt); Type a() const; Type b() const; param_type param() const; void param(const param_type& pt); }; Devices supported: Host, CPU, and GPU. Include Files ------------- - ``oneapi/mkl/rng.hpp`` Template Parameters ------------------- .. list-table:: :header-rows: 0 * - ``typename Type = float`` - Type of the produced values. The specific values are as follows: ``float`` ``double`` * - ``typename Method = oneapi::mkl::rng::uniform_method::by_default`` - Generation method. The specific values are as follows: ``oneapi::mkl::rng::uniform_method::standard`` ``oneapi::mkl::rng::uniform_method::accurate`` See brief descriptions of the methods in :ref:`distributions-template-parameter-method` Input Parameters ---------------- .. list-table:: :header-rows: 1 * - Name - Type - Description * - a - ``Type (float, double)`` - Left bound ``a`` * - b - ``Type (float, double)`` - Right bound ``b``