One way to look at the problem is to ignore (for now) the fact that you are dealing with a 2d grid. You have a set of weighted items. The standard way to randomly select from this set:
- add weights, name the amount
s - choose a single random value
0 <= u < s - iterate over the items while keeping the total number of
tweights of the items you examined. t >= u, , (, ).
, , :
( , ), . , , - , , Google , .
EDIT: , 2D-. , ( MIPMAP) , .