Exemple #1
0
        protected sealed override void Calculate()
        {
            switch (BaseType)
            {
            case BaseValueType.Int64:
            case BaseValueType.Single:
            case BaseValueType.Double: {
                double offset = MinValue.GetDouble();
                double diff   = MaxValue.GetDouble() - offset;
                _SetDouble(offset + (diff * _rand.NextDouble()));
                break;
            }

            //case BaseValueType.Int64: {
            //	byte[] b = new byte[sizeof(long)];
            //	_rand.NextBytes(b);
            //	_SetInt64(BitConverter.ToInt64(b, 0));
            //	break;
            //}
            case BaseValueType.Int32:
            default: {
                _SetInt32(_rand.Next(MinValue.GetInt32(), MaxValue.GetInt32()));
                break;
            }
            }
            if (!ManualRand)
            {
                SetDirty();
            }
        }