Use the color or luminance or hue of the images to weight the picking of 'random' pixels.This is also quite hard to do other than via the rejection method
There is a much more efficient method. See here, and here.
The trick is to build an 1D array with the accumulated weights @acu. Then, pick random numbers ($r) in the range [0, $acu[-1]) and use binary search to look for the index $ix such that $acu[$ix] <= $r <= $acu[$ix + 1].
In reply to Re^5: Randomly biased, random numbers. (A working solution)
by salva
in thread Randomly biased, random numbers.
by BrowserUk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |