Example #1
0
        protected static void shuffle(ref List <tildeInt> list)
        {
            // further improvement: remove ref
            System.Random random = new System.Random();
            tildeInt      count  = new tildeInt(list.Count);

            for (tildeInt i = new tildeInt(0); tildeBool.getOne(i < count); ++i)
            {
                tildeInt rnd  = new tildeInt(random.Next(list.Count));
                tildeInt temp = list[getOne(i)];
                list[getOne(i)]   = list[getOne(rnd)];
                list[getOne(rnd)] = temp;
            }
        }
Example #2
0
        protected static tildeBool isSorted(List <tildeInt> list)
        {
            tildeInt count = new tildeInt(list.Count);

            while (tildeBool.getOne(--count >= new tildeInt(1)))
            {
                // further improvement: implement T[] override
                if (tildeBool.getOne(list[getOne(count)] < list[getOne(count - new tildeInt(1))]))
                {
                    return(new tildeBool(false));
                }
            }
            return(new tildeBool(true));
        }
Example #3
0
        public static tildeInt operator --(tildeInt s)
        {
            tildeInt one = new tildeInt(1);

            return(s - one);
        }
Example #4
0
        public static tildeInt operator ++(tildeInt s)
        {
            tildeInt one = new tildeInt(1);

            return(s + one);
        }