.. index:: pair: class; EE::Math::MTRand .. _doxid-class_e_e_1_1_math_1_1_m_t_rand: class EE::Math::MTRand ====================== .. toctree:: :hidden: Overview ~~~~~~~~ .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class MTRand { public: // fields static const :ref:`Uint32` :target:`M` = 397; static const :ref:`Int32` :target:`N` = 624; static const :ref:`Uint32` :target:`SAVE` = :ref:`N` + 1; // construction :ref:`MTRand`(const :ref:`Uint32` oneSeed); :ref:`MTRand`(); :ref:`MTRand`(const MTRand& o); // methods MTRand& :ref:`operator=`(const MTRand& o); :ref:`Uint32` :ref:`getRandi`(); :ref:`Uint32` :ref:`getRandi`(const :ref:`Uint32` n); double :ref:`getRand`(); double :ref:`getRand`(const double n); void :ref:`setSeed`(const :ref:`Uint32` oneSeed); void :ref:`setSeed`(); :ref:`Float` :ref:`getRandf`(); :ref:`Float` :ref:`getRandf`(const :ref:`Float` n); int :ref:`getRandFromRange`(int Min, int Max); :ref:`Float` :ref:`getRandFromRange`(:ref:`Float` Min, :ref:`Float` Max); void :ref:`save`(:ref:`Uint32`* saveArray) const; void :ref:`load`(:ref:`Uint32`*const loadArray); }; .. _details-class_e_e_1_1_math_1_1_m_t_rand: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Construction ------------ .. index:: pair: function; MTRand .. _doxid-class_e_e_1_1_math_1_1_m_t_rand_1a8d3a9178b31fbae4a4504ddadf7a6cee: .. ref-code-block:: cpp :class: doxyrest-title-code-block MTRand(const :ref:`Uint32` oneSeed) Initialize with a defined user seed .. index:: pair: function; MTRand .. _doxid-class_e_e_1_1_math_1_1_m_t_rand_1a5cb59ce37dae048a0e8baa0f2dfd4aed: .. ref-code-block:: cpp :class: doxyrest-title-code-block MTRand() Initialize with a predefined seed .. index:: pair: function; MTRand .. _doxid-class_e_e_1_1_math_1_1_m_t_rand_1a051bd666a6861210e55b5e3f0fdeb9a5: .. ref-code-block:: cpp :class: doxyrest-title-code-block MTRand(const MTRand& o) Initialize with a copy of another :ref:`MTRand ` object Methods ------- .. index:: pair: function; operator= .. _doxid-class_e_e_1_1_math_1_1_m_t_rand_1a10101b3ae4d31dbcb28829dca29390c3: .. ref-code-block:: cpp :class: doxyrest-title-code-block MTRand& operator=(const MTRand& o) Copy :ref:`MTRand ` object .. index:: pair: function; getRandi .. _doxid-class_e_e_1_1_math_1_1_m_t_rand_1a6b0adc1332452a69302d32eca641ba12: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Uint32` getRandi() .. rubric:: Returns: integer in [0,2^32-1] .. index:: pair: function; getRandi .. _doxid-class_e_e_1_1_math_1_1_m_t_rand_1aa9a91a6acad3be3e0569eb8143cfa8d7: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Uint32` getRandi(const :ref:`Uint32` n) .. rubric:: Returns: integer in [0,n] for n < 2^32 .. index:: pair: function; getRand .. _doxid-class_e_e_1_1_math_1_1_m_t_rand_1abc5c401c439316f8b56a44c191a73a40: .. ref-code-block:: cpp :class: doxyrest-title-code-block double getRand() .. rubric:: Returns: real number in [0,1] .. index:: pair: function; getRand .. _doxid-class_e_e_1_1_math_1_1_m_t_rand_1a1ca971e41ace0be774c9d901077389ff: .. ref-code-block:: cpp :class: doxyrest-title-code-block double getRand(const double n) .. rubric:: Returns: real number in [0,n] .. index:: pair: function; setSeed .. _doxid-class_e_e_1_1_math_1_1_m_t_rand_1aa8cfeeed012c68fe7b0df72f54f48d82: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setSeed(const :ref:`Uint32` oneSeed) Set a new seed .. index:: pair: function; setSeed .. _doxid-class_e_e_1_1_math_1_1_m_t_rand_1ad730d2321ae573a11e5cf37f00f031c8: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setSeed() Set the default seed .. index:: pair: function; getRandf .. _doxid-class_e_e_1_1_math_1_1_m_t_rand_1ab9875b481b7bb83b6e426a75ecc9782d: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Float` getRandf() .. rubric:: Returns: float number in [0,1] .. index:: pair: function; getRandf .. _doxid-class_e_e_1_1_math_1_1_m_t_rand_1a09d0958f622e1530a363c8003567f2d6: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Float` getRandf(const :ref:`Float` n) .. rubric:: Returns: float number in [0,n] .. index:: pair: function; getRandFromRange .. _doxid-class_e_e_1_1_math_1_1_m_t_rand_1a53d435a4cd51cd169819c41a8a6c8423: .. ref-code-block:: cpp :class: doxyrest-title-code-block int getRandFromRange(int Min, int Max) .. rubric:: Returns: int number in [Min,Max] .. index:: pair: function; getRandFromRange .. _doxid-class_e_e_1_1_math_1_1_m_t_rand_1a44c29dcadaa9a599398fb616ce203985: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Float` getRandFromRange(:ref:`Float` Min, :ref:`Float` Max) .. rubric:: Returns: float number in [Min,Max] .. index:: pair: function; save .. _doxid-class_e_e_1_1_math_1_1_m_t_rand_1a9914a1edd6a94ec9b015c2b1240ad54d: .. ref-code-block:: cpp :class: doxyrest-title-code-block void save(:ref:`Uint32`* saveArray) const Save the state to an allocated array .. index:: pair: function; load .. _doxid-class_e_e_1_1_math_1_1_m_t_rand_1a13a33b8fff4469f22fff9a67e87427b5: .. ref-code-block:: cpp :class: doxyrest-title-code-block void load(:ref:`Uint32`*const loadArray) Load state from an array