I'm working on a sketch (targeted for fullscreen in Present mode) that draws a grid of random colored squares to the screen at a given scale. This happens every frame, and I'm using a PGraphics as an offscreen buffer.
The following code does exactly what I need and runs fine on my computer, but it eats up about 20% of my CPU. Since it's such a simple operation, I suspect there's probably a better way to do it I don't know about.