Once we have some kind of window preview of the rendered image (or the - in progress rendering of the image), we may add some multithreading feature into it.
A first implementation may be:
Define a list of pixels that, beforehand, is created so that the right amount of pixels is allocated in memory. All black.
Then create another list, that contains ID, or more specifically, the list of ints from 0 to the other list size (minus 1).
At this point, we can go and execute an infinite loop (or a press-a-button-to-stop-it loop) that for every iteration goes through the ID list, picks a random ID (per thread) and spawn a thread to render a sample for that pixel, then remove the ID from the list, and repeat until the ID list is empty.
Then refill the ID list with another round of IDs, and repeat the previous step.
Random pixel approach
Once we have some kind of window preview of the rendered image (or the - in progress rendering of the image), we may add some multithreading feature into it.
A first implementation may be: