Skip to content

Instantly share code, notes, and snippets.

@ruda
Created June 22, 2018 20:46
Show Gist options
  • Save ruda/788e6cbf2ba3cae6d2f0b4d0e93596d2 to your computer and use it in GitHub Desktop.
Save ruda/788e6cbf2ba3cae6d2f0b4d0e93596d2 to your computer and use it in GitHub Desktop.
Geometric figures resembling flowers
%!
/inch {72 mul} def
/cm {2.54 div 72 mul cvi} def
/maxint {2 32 exp 1 sub} def
/urand {rand maxint div} def
/forward {0 exch rlineto} def
/right {neg rotate} def
/left {rotate} def
/center {4 inch 5 inch moveto} def
/square {4 {dup forward 90 right} repeat pop} def
/flower {36 {10 right dup square} repeat pop} def
/setrandomposition {rand 8 inch mod rand 10 inch mod moveto} def
/setrandomcolor {urand urand urand setrgbcolor} def
/garden {{newpath setrandomposition setrandomcolor rand 3 cm mod flower stroke} repeat} def
25 garden
showpage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment