create polylines with different colors in leaflet/ dynamically change color of polyline

Recently while working with leaflet polyline I had a situation where I wanted to add multiple polylines with different colors.
number of polylines were different all the time, so I was not able to give different color to each polyline as my javascript was generic for adding all polylines to map.
So I found way for creating dynamic color for each polyline.
Bellow is function which creates polyline for each set of points.

function makeRoute()
  var routePolyline = new L.Polyline(pointsSelection, {
  color: get_my_color(),
  opacity: 100

Here If we see instead of giving any color I am calling function get_my_color()
This function is shown bellow.

function get_my_color() 
 var letters = '0123456789ABCDEF'.split('');
 var color = '#';
 for (var i = 0; i < 6; i++) 
    color += letters[Math.round(Math.random() * 15)];
    return color;

This will create color dynamically & send it to color property of polyline