1begin placeDot
2  # Place dot in random position.
3  #
4  circle random(2), random(2), 1
5  color "orange"
6  fill
7end
8begin fillDots densityPercent
9  clip "inside"
10  stripepath 3 / (densityPercent / 100), 0
11  samplepath 3 / (densityPercent / 100), 0
12  placeDot
13end
14begin dotDensityFill densityPercent
15  # Draw dots inside polygon.
16  #
17  fillDots densityPercent
18  # Draw polygon outline
19  #
20  color "black"
21  linestyle 0.1
22  stroke
23end
24
25newpage "eps", "tutorialrand3.eps", 60, 40
26clearpath
27box 3, 3, 20, 38
28dotDensityFill 25
29
30clearpath
31box 23, 3, 40, 38
32dotDensityFill 50
33
34clearpath
35box 43, 3, 59, 38
36dotDensityFill 100
37