I have a list of int values:
List histogram;
How do I normalize all values so that the max value in the
Iterate though, find the maximum value (call it MAXVAL), then iterate through once more and multiply every value in the list by (100/MAXVAL).
MAXVAL
(100/MAXVAL)
var ratio = 100.0 / list.Max(); var normalizedList = list.Select(i => i * ratio).ToList();