.. _oneapi-mkl-rng-save-state: oneapi::mkl::rng::save_state ============================ Writes state of the random number engine to the file or memory buffer. .. contents:: :local: :depth: 1 Description *********** The ``oneapi::mkl::rng::save_state`` function allows you to store the state of the random number engine in the binary format in a file or memory buffer. API *** Syntax ------ **Save to Memory Interface** .. code-block:: cpp template void save_state (Engine& engine, std::uint8_t* mem); **Save to File Interface** .. code-block:: cpp template void save_state (Engine& engine, const std::string& filename); Include Files ------------- - ``oneapi/mkl/rng.hpp`` Input Parameters ---------------- **Save to Memory Interface** .. list-table:: :header-rows: 1 * - Name - Type - Description * - engine - ``Engine&`` - Object of engine class, which state would be saved. * - mem - ``std::uint8_t*`` - Memory, which you allocate to store the engine's state. To check the size of memory in bytes needed for the particular engine, use the ``oneapi::mkl::rng::get_state_size`` function. **Save to File Interface** .. list-table:: :header-rows: 1 * - Name - Type - Description * - engine - ``Engine&`` - Object of engine class, which state would be saved. * - filename - ``const std::string&`` - Name of the file where the engine's state would be written.