Does it have to be coded like this? As in, is this an assignment?

Really, this is making it much more difficult on yourself. Any graphic editor can create 3 separate images of random noise. Then...