Added a function to map from an array of values to 0 to 1