System.Collections.Tests.IList_NonGeneric_Tests.CreateT C# (CSharp) Method

CreateT() protected method

Creates an object that is dependent on the seed given. The object may be either a value type or a reference type, chosen based on the value of the seed.
protected CreateT ( int seed ) : object
seed int
return object
        protected virtual object CreateT(int seed)
        {
            if (seed % 2 == 0)
            {
                int stringLength = seed % 10 + 5;
                Random rand = new Random(seed);
                byte[] bytes = new byte[stringLength];
                rand.NextBytes(bytes);
                return Convert.ToBase64String(bytes);
            }
            else
            {
                Random rand = new Random(seed);
                return rand.Next();
            }
        }
IList_NonGeneric_Tests