10/27/2023 5:28:50 PM

The following is a simple function that will take an array/list of decimal values and convert them to an array/list of normalize values. These values will be normalize between 0-1.

static void Main(string[] args) { var inputs = new List<decimal>() { 1, 2, 4 }; var normalized_values = Normalize_MinMax(inputs); for (var x = 0; x < inputs.Count; x++) { Console.WriteLine("Input: " + inputs[x] + " | Output: " + normalized_values[x]); } Console.WriteLine("Hit Any Key to Exist..."); var r = Console.ReadKey(); } public static List<decimal> Normalize_MinMax(List<decimal> inputs) { var input_min = inputs.Min(); var input_max = inputs.Max(); //output list var normalized_values = new List<decimal>(); //normalize function foreach (var input in inputs) { var normalized_value = (input - input_min) / (input_max - input_min); normalized_values.Add(normalized_value); } return normalized_values; }