//+------------------------------------------------------------------+ //| Main.mqh | //| Copyright 2026, Niquel Mendoza | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2026, Niquel Mendoza" #property link "https://www.mql5.com" #property strict #ifndef PRNGBYLEO_SRC_IMP_NATIVE_NAT_MQH #define PRNGBYLEO_SRC_IMP_NATIVE_NAT_MQH //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ namespace TSN { //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ class CMathRandNative { protected: //--- uint m_last_seed; public: CMathRandNative(void); ~CMathRandNative(void) {} //--- void Seed(uint seed); __forceinline uint LastSeed() const { return m_last_seed; } //--- __forceinline uint nextUInt32(void) const; __forceinline ulong nextUInt64(void) const; }; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ CMathRandNative::CMathRandNative() { // para no alterar el global no habra nada aqui cada uno qeu sea responsable } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void CMathRandNative::Seed(uint seed) { m_last_seed = _RandomSeed; MathSrand(seed); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ __forceinline uint CMathRandNative::nextUInt32(void) const { return uint(MathRand()) | uint(MathRand()) << 16; } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ __forceinline ulong CMathRandNative::nextUInt64(void) const { return ulong(MathRand()) | ulong(MathRand()) << 16 | ulong(MathRand()) << 32 | ulong(MathRand()) << 48; } } #endif // PRNGBYLEO_SRC_IMP_NATIVE_NAT_MQH