"Noise colored TV" style?

Hello all,

newbie on Processing, I check this code on the web and I would to know how could I make a “random colored noise as TV style” ? Not just black an white pixels, but random colored pixels.

import com.hamoid.*;

void setup()
  size(1000, 500);

void draw() 
  for(int x = 0; x<width; x++) 
    for(int y =0; y<height; y++)
      float bright1 = random(255);
      pixels[x+y*width] = color(bright1);

Thank you for your help!

replace with

pixels[x+y*width] = color(random(256),random(256),random(256));

1 Like

Many thanks, it’s works :slight_smile:

1 Like


For your example you can update the pixels array in one loop:

  for(int i = 0; i<pixels.length; i++)
    //fast and may reach 60 fps
    pixels[i] = int(random(0x00FFFFFF+1)) | 0xFF000000; // 0xFF000000 to OxFFFFFFFF
    //slow and may not reach 60 fps
    //pixels[i] = color(random(256), random(256), random(256));

As a newbie I encourage you to peruse the tutorials, references and examples here:


This will work also:

int(random(0xFF000000, 0)); //0xFFFFFFFF+1 = 0


Hi @Lorangeverte and welcome
This is short idea about TV

White noise is only white and earned the name because it is white
The source of the white noise in analogue televisions is the local oscillator signal that mixes with the received signal. There is no color noise

In the past, the color signal carrier used several systems, such as PAL, SECAM, etc. The color system on the TV does not work unless it receives a color signals containing RGB data.

SO TV just show’s white noise

This code like @Chrisir said

void setup() {
  size(500, 400);
void draw() {

  for (int i = 0; i < pixels.length; i = i+25) {
    int j = int (random (pixels.length ));

    float R = random(255);
    float G = random (255);
    float B = random (255);
   // pixels[j] = color( random(255));

     pixels[j] = color( R,G,B);


Thanks all, for code and help :slight_smile: