Apply Gradient from Image

can someone help us in creating the script to automatically applying the random gradient colors from the image to each object in the active selection 

Parents
No Data
Reply Children
No Data