2 function uniform_random($minval, $maxval)
7 $state = 2*$state < $state ?
(2*$state ^
$poly) : 2*$state;
8 return floor($minval +
$state * ($maxval - $minval) / 4294967296.0);
15 $sur = new CairoImageSurface(FORMAT_ARGB32
, $size+
3, $size +
3);
16 $con = new CairoContext($sur);
18 $con->set_source_rgb(0,0,0);
24 $con->set_fill_rule(FILL_RULE_EVEN_ODD
);
27 for($i=0; $i<$numseg;$i++
) {
28 $x = uniform_random(0,$width);
29 $y = uniform_random(0,$height);
36 $con->set_source_rgb(1,0,0);
37 $con->fill_preserve();
38 $con->set_source_rgb(0,1,0);
39 $con->set_line_width(0.5);
42 $sur->write_to_png("random-intersection-php.png");