%!PS, siehe https://digitalartarchive.siggraph.org/artwork/georg-nees-gravel-stones/ % $Id: schotter.ps,v 1.5 2024/01/12 11:30:32 oj14ozun Exp $ % https://wwwcip.cs.fau.de/~oj14ozun/src+etc/schotter.ps % parameters /rows 24 def %number of rows /cols 12 def %number of columns /unit 24 def %size of a square % golden ratio (because of course) /phi 5 sqrt 1 add 2 div def % ensure a new random seed for every run realtime srand % draw a square /square { currentpoint unit unit rectstroke } def % generate a random real in an interval [0;i] /randi { rand 2 31 exp 1 sub div mul } def % add attribution 10 10 moveto /Helvetica findfont 10 scalefont setfont (Nach "Schotter" von Georg Nees) show % draw the grid downwards currentpagedevice /PageSize get dup dup 0 get exch 1 get translate %the origin is ↗ 180 rotate %draw downwards % try to centre the unjittered grid dup 0 get %page width cols unit mul %grid width sub 2 div exch 1 get %page height rows unit mul %grid height sub 2 div moveto %use as start point % draw the grid, restarting the jitter for each column cols { gsave rand 3 mod 1 sub rotate %initial jitter 0 1 rows { phi mul dup randi exch 2 div sub gsave dup dup rmoveto rotate square grestore 0 unit rmoveto } for grestore unit 0 rmoveto } repeat showpage