1

The problem is as follows:

  1. I have about ~1000 pixels out of 20000*2 whose positions I want to avoid by some distance (a few pixels, say, away from each of those positions).

  2. I want to randomly select ~100,000 of the remaining pixels without replacement and record their positions (which I am finding is the difficult part).

At the moment I:

A. Create a mask from the 1000 positions.

B. Make a list of tuples containing the unmasked positions.

C. Draw from a flattened integer list describing that list of tuples. Hey presto!

But the memory requirements for B are huge and the limiting factor. I am less concerning about speed.

This is the same as memory efficient random number iterator without replacement but with masked circles (swiss cheese). I wonder if it's best just to keep sampling without replacement until the 100,000 are obtained.

Thanks!

Community
  • 1
  • 1
jtlz2
  • 7,700
  • 9
  • 64
  • 114
  • Ummm... what does the mask change for you when it comes to the memory? Or maybe give a precise question. You can try to draw a number, and check it against the mask in `O(M)` trivially or `O(ln(M))` less trivially, where `M` is `size(mask)`. You don't need need a copy of whole table with out some elements. If you fail, you retry, or find a closest point, or whatever. – luk32 Dec 22 '14 at 08:54
  • How are you storing the masks? What data structure are you using? – Addison Dec 22 '14 at 08:55

0 Answers0