Dear Michele, Find attached the new function for the random selection of the pixels. Best regards, Mario [random_sampling_equal_neighbours.zip](https://github.com/SARScripts/INSAR_Classification/files/8107535/random_sampling_equal_neighbours.zip)