Hello, i'm placing this bid just to share my thoughts and my algorithm results. The biggest performance drop is caused by randomizing new number that fits the criteria (Hamming distance greater than Y, compared with elements in array). For Y that is higher than 1/4 of bits count, my algorithm becomes very slow. I.e. generating N=500 Y=5 took less than a second but Y=7 takes few minutes. My another approach involved prearranged array. Array was filled with N elements, that meet criteria, but the starting point was 1, 2, 3, 4... This reduced N=500, Y=7 time to 10 seconds but the output array become pseudo random (limited range of 1..highest N value, instead of full 24-bit range). Then i moved back to first version but split the task to multiple workers. It slightly increased the performance but it is still not really acceptable, especially if you need it to work with Y set to high (like 10 or 15). A correct solution would make use of evolutionary algorithms, but that's beyond of my "regular programmer" scope ;-) Good luck with the project!