public void Randomize(double num)
            {
                int num1 = _seed;
                int num2 = !BitConverter.IsLittleEndian ? BitConverter.ToInt32(BitConverter.GetBytes(num), 0) : BitConverter.ToInt32(BitConverter.GetBytes(num), 4);
                int num3 = (num2 & (int)ushort.MaxValue ^ num2 >> 16) << 8;
                int num4 = num1 & -16776961 | num3;

                _seed = num4;
            }
Ejemplo n.º 2
0
 /// <summary>
 /// Writes a value of the specified type to this buffer.
 /// </summary>
 /// <param name="value">DOUBLE value to be written.</param>
 /// <exception cref="System.IndexOutOfRangeException"/>
 public void Write(double value)
 {
     byte[] bytes = BitConverter.GetBytes(value);
     for (int i = 0; i < bytes.Length; i++)
     {
         memory[iterator++] = bytes[i];
     }
     iterator = (iterator + fastAlign) & fastAlignNot;
 }
Ejemplo n.º 3
0
        public void WriteRecord(Record record, long index)
        {
            Stream.Position = index * _pageSize;

            Stream.Write(BC.GetBytes(record.Radius), 0, sizeof(double));
            Stream.Write(BC.GetBytes(record.Angle), 0, sizeof(short));
            Stream.Flush();
            DiskOperations++;
        }
            public void Randomize()
            {
                System.DateTime now   = System.DateTime.Now;
                float           timer = (float)checked ((60 * now.Hour + now.Minute) * 60 + now.Second) + (float)now.Millisecond / 1000f;
                int             num1  = _seed;
                int             num2  = BitConverter.ToInt32(BitConverter.GetBytes(timer), 0);
                int             num3  = (num2 & (int)ushort.MaxValue ^ num2 >> 16) << 8;
                int             num4  = num1 & -16776961 | num3;

                _seed = num4;
            }
            public float VBNext(float num)
            {
                int num1 = _seed;

                if ((double)num != 0.0)
                {
                    if ((double)num < 0.0)
                    {
                        long num2 = (long)BitConverter.ToInt32(BitConverter.GetBytes(num), 0) & (long)uint.MaxValue;
                        num1 = checked ((int)(num2 + (num2 >> 24) & 16777215L));
                    }
                    num1 = checked ((int)((long)num1 * 1140671485L + 12820163L & 16777215L));
                }
                _seed = num1;
                return((float)num1 / 1.677722E+07f);
            }