Without getting into ruler generation or a grid class etc., here is a very simple sketch to show you how rulers can work as simple lists of pixel values.
// define rulers
float[] rx = new float[]{0, 10, 60, 70, 120, 130, 180, 190, 240, 250};
float[] ry = new float[]{0, 10, 60, 70, 120, 130, 180, 190, 240, 250};
size(250, 250);
ellipseMode(CORNERS);
rectMode(CORNERS);
// draw elements using ruler values
ellipse(rx[1], ry[1], rx[2], ry[2] );
rect( rx[2], ry[2], rx[5], ry[7] );
rect( rx[3], ry[3], rx[4], ry[4] );
fill(0);
text( "hi", rx[3], ry[3], rx[4], ry[4] );
// show ruler guidelines
stroke(255, 0, 0, 32);
for (int i=0; i<rx.length; i++) {
line(rx[i],0,rx[i],height);
}
for (int i=0; i<ry.length; i++) {
line(0,ry[i],width,ry[i]);
}
So, to make those lines random, you can march up by random values:
for (int i=1; i<rx.length; i++) {
rx[i] = rx[i-1] + (int)random(50);
}
for (int i=1; i<ry.length; i++) {
ry[i] = ry[i-1] + (int)random(50);
}
…now each time you get a random grid.