import body, visual, math
from random import random

class RandomBody(body.Body):
    def __init__(self):
        radius = random() * 0.5
        body.Body.__init__(
            self,
            radius = radius,
            mass = 0.1 * (4./3.) * math.pi * radius**3,
            vel = randomVector(0.05),
            pos = (randomVector(8.0)),
            color = (random(), random(), random()))
        
def signedRandom(maxSize):
    return random() * maxSize * 2.0 - maxSize

def randomVector(maxSize):
    return visual.vector(signedRandom(maxSize),
                         signedRandom(maxSize),
                         signedRandom(maxSize)) 
