.. _oneapi-mkl-rng-load-state: oneapi::mkl::rng::load_state ============================ Loads the state of the random number engine from the provided memory buffer or file, then creates new engine object. .. contents:: :local: :depth: 1 Description *********** The ``oneapi::mkl::rng::load_state`` function allows you to create a new random number engine object from the binary state of another engine, which was written in a memory buffer or file. You can use different ``sycl::queue`` objects for the new engine. API *** Syntax ------ **Load from Memory Interface** .. code-block:: cpp template Engine load_state (const sycl::queue& queue, const std::uint8_t* mem); **Load from File Interface** .. code-block:: cpp template Engine load_state (const sycl::queue& queue, const std::string& filename); Include Files ------------- - ``oneapi/mkl/rng.hpp`` Input Parameters ---------------- **Load from Memory Interface** .. list-table:: :header-rows: 1 * - Name - Type - Description * - queue - ``const sycl::queue& queue`` - ``sycl::queue`` object, which will be used for the newly-created engine. * - mem - ``const std::uint8_t*`` - Memory, where engine\'s state was stored. **Load from File Interface** .. list-table:: :header-rows: 1 * - Name - Type - Description * - queue - ``const sycl::queue& queue`` - ``sycl::queue`` object, which will be used for the newly-created engine. * - filename - ``const std::string&`` - Name of the file where engine\'s state was written. Output Parameters ----------------- .. list-table:: :header-rows: 1 * - Type - Description * - Engine - New random number engine object, which would be created from the given ``sycl::queue`` and loaded engine\'s state. The following code illustrates how to store the engine\'s state to the ``engine_state.dat`` file and load it back: Code for Save/Load state functionality -------------------------------------- .. literalinclude:: /_examples/load_state.cpp :language: cpp :linenos: