Exemple #1
0
            public object random()
            {
                lock (this) {
                    byte[] randA = new byte[sizeof(uint)];
                    byte[] randB = new byte[sizeof(uint)];
                    _rnd.NextBytes(randA);
                    _rnd.NextBytes(randB);

                    // this is pulled from _randommodule.c from CPython
                    uint a = BitConverter.ToUInt32(randA, 0) >> 5;
                    uint b = BitConverter.ToUInt32(randB, 0) >> 6;
                    return((a * 67108864.0 + b) * (1.0 / 9007199254740992.0));
                }
            }
Exemple #2
0
 public void jumpahead(int count)
 {
     lock (this) {
         _rnd.NextBytes(new byte[4096]);
     }
 }