title: Randomly place objects USING ALPHA MAP
body: <p>I want to randomly place objects USING ALPHA MAP (only black color, not grayscale). The black areas on the map are using to determine where we CAN place an object.</p>
  
  <p>Why do I want to do this? For example, we have some terrain with a river. We want to randomly place a chest on that terrain and the point is we want our chest NOT TO BE IN THE RIVER. We have a special location to place that chest and that location can have a very complex structure.</p>
  
  <p>Simple map with lake and river:</p>
  
  <p><img src="https://i.stack.imgur.com/qLFS7.png" alt="link for simple map with lake and river image"></p>
  
  <p>Black/white map of the location for placing objects:</p>
  
  <p><img src="https://i.stack.imgur.com/66GQX.png" alt="link for black/white map of the location for placing objects image"></p>
  
  <p>Of course, we can just take random points with Random.Range() and check each point by comparing it with pixel values: "Is the point on the black area?" BUT if we would have a very small (&lt;10% of total area) and complex "available" area (for example, islands in the swamp) then there will be a very large amount of "garbage" points. Therefore it is very inefficient method.</p>
  
  <p>Does the quick and performance technique exist to get desirable amount of "available" points?</p>