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->setSourceRgb(0,0,0);
24 $con->setFillRule(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->setSourceRgb(1,0,0);
38 $con->setSourceRgb(0,1,0);
39 $con->setLineWidth(0.5);
42 $sur->writeToPng("random-intersection-php.png");