10 print chr$(205.5+rnd(1)); : goto 10

Almost 3 years later!

Leaner (108 characters) than my last version (113 characters).

size(530,530);for(int i=0,y=0,n=23;i<n*n;i++){int r=(int)random(2)*n,x=i%n*n;y=i/n*n;line(x+r,y,x+n-r,y+n);}
size(530, 530);
for(int i=0, y=0, n=23; i<n*n; i++)
  {
  int r=(int)random(2)*n, x=i%n*n;
  y=i/n*n;
  line(x+r, y, x+n-r, y+n); 
  }

Another variation at 108 characters:

size(530,530);int i=0,n=23;while(i<n*n){int r=(int)random(2)*n,x=i%n*n;int y=i++/n*n;line(x+r,y,x+n-r,y+n);}
size(530, 530);
int i=0, n=23;  
while(i<n*n)
  {
  int r=(int)random(2)*n, x=i%n*n;
  int y=i++/n*n;
  line(x+r, y, x+n-r, y+n);
  }

And yet another version at 104 characters!

size(530,530);int i=0,n=23;while(i<n*n){int r=(int)random(2)*n,x=i%n*n,y=i++/n*n;line(x+r,y,x+n-r,y+n);}
size(530, 530);
int i=0, n=23;  
while(i<n*n)
  {
  int r=(int)random(2)*n, x=i%n*n, y=i++/n*n;
  line(x+r, y, x+n-r, y+n);
  }

I will come back in 3 years to revisit this! Maybe sooner… :)

Back…

This version has 103 characters:

size(530, 530);for(int j=0,m=23;j<m*m;){int r=(int)random(2)*m,x=j%m*m,y=j++/m*m;line(x+r,y,x+m-r,y+m);}  
size(530, 530);  
for(int j=0, m=23; j<m*m;)
  {
  int r=(int)random(2)*m, x=j%m*m, y=j++/m*m;
  line(x+r, y, x+m-r, y+m);
  }

:)

3 Likes