コード例 #1
0
ファイル: _random.cs プロジェクト: zuvys/ironpython3
            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));
                }
            }
コード例 #2
0
ファイル: _random.cs プロジェクト: zpeach68/ironpython2
 public void jumpahead(int count)
 {
     lock (this) {
         _rnd.NextBytes(new byte[4096]);
     }
 }