added function to calculate euclidean distance of two vectors and simulation, in which different patterns can be presented