Using the data storage type defined on this page for raster images, write the image to a PPM file (binary P6 prefered).

(Read the definition of PPM file on Wikipedia.)




integer i, h, j, w;
file f;
 
w = 640;
h = 320;
 
f.create("out.ppm", 00644);
f.form("P6\n~ ~\n255\n", w, h);
 
j = 0;
do {
    srand(j >> 4);
    i = 0;
    do {
        16.times(f_bytes, f, drand(255), drand(255), drand(255));
    } while ((i += 16) < w);
} while ((j += 1) < h);