Updating the statistics application
In this section, we are going to improve the functionality and the operation of the statistics application. When there is no valid input, we are going to populate the statistics application with ten random values, which is pretty handy when you want to put lots of data in an application for testing purposes—you can change the number of random values to fit your needs. However, keep in mind that this takes place when all user input is invalid.
I have randomly generated data in the past in order to put sample data into Kafka topics, RabbitMQ queues and MySQL tables.
Additionally, we are going to normalize the data. Officially, this is called z-normalization and is helpful for allowing sequences of values to be compared more accurately. We are going to use normalization in forthcoming chapters.
The function for the normalization of the data is implemented as follows:
func normalize(data []float64, mean float64, stdDev...