Return a random [r,g,b] color value.

syntax

random_color()

returns

3-element list containing (r,g,b) values between 0.0 and 1.0

examples

draw a random colored cube

def display():
   lighting(False)
   color(random_color())
   cube(3.0)

assign random colors to new objects

def init():
   Global.points = [random_vertex(-5, 5) for _ in range(10)] 
   Global.colors = [random_color() for _ in range(10)]

def display():
   lighting(False)
   for (col, point) in zip(Global.colors, Global.points):
      color(col)
      pushMatrix()
      translate(point)
      sphere(0.5)
      popMatrix()