예제 #1
0
 public static void Set(ManagedIntList dst, int value)
 {
     for (var i = 0; i < dst.Length(); i++)
     {
         dst[i] = value;
     }
 }
예제 #2
0
        public int Test(ManagedArray output, ManagedIntList classification, int category = 1)
        {
            var errors = 0;

            for (var i = 0; i < classification.Length(); i++)
            {
                var correct = (int)output[i] != category ? 0 : category;

                errors += correct != classification[i] ? 1 : 0;
            }

            return(errors);
        }
예제 #3
0
        // Fisher–Yates shuffle algorithm
        public static void Shuffle(ManagedIntList index_list)
        {
            System.Random random = new System.Random(System.Guid.NewGuid().GetHashCode());

            int n = index_list.Length();

            for (int i = n - 1; i > 1; i--)
            {
                int rnd = random.Next(i + 1);

                var value = index_list[rnd];

                index_list[rnd] = index_list[i];

                index_list[i] = value;
            }
        }