RandomInt64() public static method

public static RandomInt64 ( RandomGenerator rand ) : long
rand PeterO.RandomGenerator
return long
示例#1
0
        public static CBORObject RandomNumberOrRational(RandomGenerator rand)
        {
            switch (rand.UniformInt(7))
            {
            case 0:
                return(CBORObject.FromObject(
                           RandomObjects.RandomDouble(
                               rand,
                               Int32.MaxValue)));

            case 1:
                return(CBORObject.FromObject(
                           RandomObjects.RandomSingle(
                               rand,
                               Int32.MaxValue)));

            case 2:
                return(CBORObject.FromObject(RandomObjects.RandomEInteger(rand)));

            case 3:
                return(CBORObject.FromObject(RandomObjects.RandomEFloat(rand)));

            case 4:
                return
                    (CBORObject.FromObject(RandomObjects.RandomEDecimal(rand)));

            case 5:
                return(CBORObject.FromObject(RandomObjects.RandomInt64(rand)));

            case 6:
                return(CBORObject.FromObject(RandomObjects.RandomERational(rand)));

            default: throw new ArgumentException();
            }
        }
示例#2
0
        public static CBORObject RandomNumberOrRational(IRandomGenExtended rand)
        {
            object o = null;

            switch (rand.GetInt32(7))
            {
            case 0:
                o = RandomObjects.RandomDouble(
                    rand,
                    Int32.MaxValue);
                return(CBORObject.FromObject(o));

            case 1:
                o = RandomObjects.RandomSingle(
                    rand,
                    Int32.MaxValue);
                return(CBORObject.FromObject(o));

            case 2:
                return(CBORObject.FromObject(
                           RandomObjects.RandomEInteger(rand)));

            case 3:
                return(CBORObject.FromObject(
                           RandomObjects.RandomEFloat(rand)));

            case 4:
                o = RandomObjects.RandomEDecimal(rand);
                return(CBORObject.FromObject(o));

            case 5:
                o = RandomObjects.RandomInt64(rand);
                return(CBORObject.FromObject(o));

            case 6:
                o = RandomObjects.RandomERational(rand);
                return(CBORObject.FromObject(o));

            default: throw new InvalidOperationException();
            }
        }
示例#3
0
        public static CBORObject RandomNumberOrRational(RandomGenerator rand)
        {
            object o = null;

            switch (rand.UniformInt(7))
            {
            case 0:
                o = RandomObjects.RandomDouble(
                    rand,
                    Int32.MaxValue);
                return(ToObjectTest.TestToFromObjectRoundTrip(o));

            case 1:
                o = RandomObjects.RandomSingle(
                    rand,
                    Int32.MaxValue);
                return(ToObjectTest.TestToFromObjectRoundTrip(o));

            case 2:
                return(ToObjectTest.TestToFromObjectRoundTrip(
                           RandomObjects.RandomEInteger(rand)));

            case 3:
                return(ToObjectTest.TestToFromObjectRoundTrip(
                           RandomObjects.RandomEFloat(rand)));

            case 4:
                o = RandomObjects.RandomEDecimal(rand);
                return(ToObjectTest.TestToFromObjectRoundTrip(o));

            case 5:
                o = RandomObjects.RandomInt64(rand);
                return(ToObjectTest.TestToFromObjectRoundTrip(o));

            case 6:
                o = RandomObjects.RandomERational(rand);
                return(ToObjectTest.TestToFromObjectRoundTrip(o));

            default: throw new InvalidOperationException();
            }
        }