Random Numbers Generator

I am making a random number generator using the code:

void setup(){
size(600,600);
textSize(40);
}

void draw(){
background(0);
text(random(20),100,200);
frameRate(1);
}
But I want the numbers to stop when I click my mouse, and display the number on the screen, but cant quite figure out how to do this.

Maybe this

boolean randomize = true;
float value;
void setup() {
  size(600, 600);
  frameRate(1);
  textSize(40);
}
void draw() {
  background(0);
  if (randomize) value = random(20);
  text(value, 100, 200);
}
void mouseClicked() {
  randomize =! randomize;
}

The solution of @matheplica is nice because it allows you to extend on it and do draw other things on screen while still displaying the number.

Now a simpler approach but way less extendable would be to deal with everything in your mouseClicked() function:

void setup() {
  size(600, 600);
  background(20);
}

void draw() {
}

void mouseClicked() {
  background(20);
  fill(200);  
  textSize(40);
  text(random(20), 100, 200);
}

Or prehaps:

boolean stop = false;
void setup(){
  size(600,600);
  textSize(40);
}

void draw(){
  background(0);
  text(random(20),100,200);
  frameRate(1);
}

void mousePressed(){
  if(!stop){
    noLoop();
    stop = !stop;
  } else {
    loop();
    stop = !stop;
  }
}

There are many ways to do it