Beispiel #1
0
def random_car(car):
    car.make = choice(MAKES)
    car.model = choice(MODELS)
    car.color = rand_int(len(COLORS))

    car.seats = 2 + rand_int(6)
    car.doors = 2 + rand_int(3)

    for _ in range(4):
        wheel = car.wheel.add()
        wheel.diameter = 25 + rand_int(15)
        wheel.air_pressure = 30 + rand_double(20)
        wheel.snow_tires = rand_int(16) == 0

    car.length = 170 + rand_int(150)
    car.width = 48 + rand_int(36)
    car.height = 54 + rand_int(48)
    car.weight = car.length * car.width * car.height / 200

    engine = car.engine
    engine.horsepower = 100 * rand_int(400)
    engine.cylinders = 4 + 2 * rand_int(3)
    engine.cc = 800 + rand_int(10000)
    engine.uses_gas = True
    engine.uses_electric = rand_bool()

    car.fuel_capacity = 10.0 + rand_double(30.0)
    car.fuel_level = rand_double(car.fuel_capacity)
    car.has_power_windows = rand_bool()
    car.has_power_steering = rand_bool()
    car.has_cruise_control = rand_bool()
    car.cup_holders = rand_int(12)
    car.has_nav_system = rand_bool()
Beispiel #2
0
def random_car(car):
    car.make = choice(MAKES)
    car.model = choice(MODELS)
    car.color = rand_int(len(COLORS))

    car.seats = 2 + rand_int(6)
    car.doors = 2 + rand_int(3)

    for _ in range(4):
        wheel = car.wheel.add()
        wheel.diameter = 25 + rand_int(15)
        wheel.air_pressure = 30 + rand_double(20)
        wheel.snow_tires = rand_int(16) == 0

    car.length = 170 + rand_int(150)
    car.width = 48 + rand_int(36)
    car.height = 54 + rand_int(48)
    car.weight = car.length * car.width * car.height // 200

    engine = car.engine
    engine.horsepower = 100 * rand_int(400)
    engine.cylinders = 4 + 2 * rand_int(3)
    engine.cc = 800 + rand_int(10000)
    engine.uses_gas = True
    engine.uses_electric = rand_bool()

    car.fuel_capacity = 10.0 + rand_double(30.0)
    car.fuel_level = rand_double(car.fuel_capacity)
    car.has_power_windows = rand_bool()
    car.has_power_steering = rand_bool()
    car.has_cruise_control = rand_bool()
    car.cup_holders = rand_int(12)
    car.has_nav_system = rand_bool()
Beispiel #3
0
def random_car(car):
    car.make = choice(MAKES)
    car.model = choice(MODELS)
    car.color = choice(COLORS)

    car.seats = 2 + rand_int(6)
    car.doors = 2 + rand_int(3)

    for wheel in car.init('wheels', 4):
        wheel.diameter = 25 + rand_int(15)
        wheel.airPressure = 30 + rand_double(20)
        wheel.snowTires = rand_int(16) == 0

    car.length = 170 + rand_int(150)
    car.width = 48 + rand_int(36)
    car.height = 54 + rand_int(48)
    car.weight = car.length * car.width * car.height // 200

    engine = car.init('engine')
    engine.horsepower = 100 * rand_int(400)
    engine.cylinders = 4 + 2 * rand_int(3)
    engine.cc = 800 + rand_int(10000)
    engine.usesGas = True
    engine.usesElectric = rand_bool()

    car.fuelCapacity = 10.0 + rand_double(30.0)
    car.fuelLevel = rand_double(car.fuelCapacity)
    car.hasPowerWindows = rand_bool()
    car.hasPowerSteering = rand_bool()
    car.hasCruiseControl = rand_bool()
    car.cupHolders = rand_int(12)
    car.hasNavSystem = rand_bool()
Beispiel #4
0
def random_car(car):
    car.make = choice(MAKES)
    car.model = choice(MODELS)
    car.color = choice(COLORS)

    car.seats = 2 + rand_int(6)
    car.doors = 2 + rand_int(3)

    for wheel in car.init('wheels', 4):
        wheel.diameter = 25 + rand_int(15)
        wheel.airPressure = 30 + rand_double(20)
        wheel.snowTires = rand_int(16) == 0

    car.length = 170 + rand_int(150)
    car.width = 48 + rand_int(36)
    car.height = 54 + rand_int(48)
    car.weight = car.length * car.width * car.height / 200

    engine = car.init('engine')
    engine.horsepower = 100 * rand_int(400)
    engine.cylinders = 4 + 2 * rand_int(3)
    engine.cc = 800 + rand_int(10000)
    engine.usesGas = True
    engine.usesElectric = rand_bool()

    car.fuelCapacity = 10.0 + rand_double(30.0)
    car.fuelLevel = rand_double(car.fuelCapacity)
    car.hasPowerWindows = rand_bool()
    car.hasPowerSteering = rand_bool()
    car.hasCruiseControl = rand_bool()
    car.cupHolders = rand_int(12)
    car.hasNavSystem = rand_bool()