Here is some code form Processing with IGEO. You can use IRandom.percent() to create a condition which is switched probabilistically by putting percentage in its argument. Can we do it the same in GH_Python?
for i in range(50) :
for j in range(50) :
x = i4-100
y = j4-100
# 50% probability to be executed
if IRand.pct(50) :
ISurface(x,y,0,x+2,y,0,x+2,y,50).clr(1.,1.,1.)
# 50% of the rest ( = 25%)
elif IRand.pct(50) :
ISurface(x,y,0,x+2,y,0,x+2,y,20).clr(0,1.,1.)
# 50% of the rest of the rest ( = 12.5%)
elif IRand.pct(50) :
ISurface(x,y,0,x+2,y,0,x+2,y,10).clr(1.,0,0)