Generación de números aleatorios distribuidos uniformemente (0,1) - página 19

 
AlexEro >>:

2º algoritmo


void OnStart()
  {
//---
   MathSrand((int)TimeLocal());

   for(int i=0;i<10000;i++)
   {
   Print(DRNG_Tausworthe());
   }

  }
//+------------------------------------------------------------------+

// Tausworthe is a nice option. It gives 2^88 non-repetitive numbers.
// A handful of primitive operations, and extremely good randomness;
static long s1 = 1423667, s2 = 2234, s3 = 34567 ; // any non-zero numbers
long RNG_Tausworthe ()
{       long b ;
        b = ( (s1 << 13) ^ s1) >> 19;
        s1 = ( (s1 & 4294967294) << 12) ^ b;
        b = ( (s2 << 2) ^ s2) >> 25;
        s2 = ( (s2 & 4294967288) << 4) ^ b ;
        b = ( (s3 << 3) ^ s3) >> 11 ;
        s3 = ( (s3 & 4294967280) << 17) ^ b ;
        return (s1 ^ s2 ^ s3);
}
// Or, simply:
// s1=((s1&4294967294)<<12)^(((s1<<13)^s1)>>19) ;
// s2=((s2&4294967288)<<4)^(((s2<<2)^s2)>>25) ;
// s3=((s3&4294967280)<<17)^(((s3<<3)^s3)>>11) ;
// return (s1^s2^s3) ;

//............................./ DRNG_Tausworthe \.................................
double DRNG_Tausworthe (void)
{       return ( (double) RNG_Tausworthe () * 2.3283064365 e-10);
}

¿Qué he hecho mal?

 
joo >>:

2-й алгоритм


Что я не так сделал?

Operaciones de golpeo. Y no tú, sino probablemente MetaQuotes.

 

Disculpas si ya se ha tocado este tema, he iniciado un hilo aparte sobre el tema de GOSN que me interesa:

https://forum.mql4.com/ru/31779

Razón de la queja: