예제 #1
0
            private int GetInt()
            {
                if (this.IX == 0)
                {
                    this.MixBuffer();
                }
                var val = this.Buffer[this.IX];

                this.IX = (this.IX + 1) % 624;
                val    ^= Scrambler.RShift(val, 11) ^ Scrambler.LShift(val ^ Scrambler.RShift(val, 11), 7) & 0x9D2C5680;
                return((int)(Scrambler.RShift(val ^ Scrambler.LShift(val, 15L) & 0xEFC60000, 18L) ^ val ^ Scrambler.LShift(val, 15L) & 0xEFC60000));
            }
예제 #2
0
            private static ulong[] SeedBuffer(ulong seed)
            {
                var buffer = new ulong[624];

                for (int i = 0; i < 624; i++)
                {
                    buffer[i] = seed;
                    seed      = (1812433253 * ((seed ^ Scrambler.RShift(seed, 30)) + 1)) & 0xFFFFFFFF;
                }

                return(buffer);
            }
예제 #3
0
            private void MixBuffer()
            {
                var i = 0;
                var j = 0;

                while (i < 624)
                {
                    i += 1;
                    var v4 = (this.Buffer[i % 624] & 0x7FFFFFFF) + (this.Buffer[j] & 0x80000000);
                    var v6 = Scrambler.RShift(v4, 1) ^ this.Buffer[(i + 396) % 624];
                    if ((v4 & 1) != 0)
                    {
                        v6 ^= 0x9908B0DF;
                    }
                    this.Buffer[j] = v6;
                    j += 1;
                }
            }