public static void Set(ManagedIntList dst, int value) { for (var i = 0; i < dst.Length(); i++) { dst[i] = value; } }
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); }
// 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; } }