Question: How do I write a procedure that gives an attribute to a polygon taking into account a probability ?

I’ve created a basic model of a two-lane road.

 

I’d like to write a procedure that will give a color to the two rectangles of the first line ( at  the bottom ) which symbolizes the presence or the absence (white) of a car, taking into account a certain probability p that is the probability that a car enter this road. I don't see how to begin except tge fact that p in an argument of the procedure.

Please Wait...