Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(1)  |  Call(0)  |  Derive(0)  |  Import(1)
float(x) -> floating point number

Convert a string or number to a floating point number, if possible.

src/p/y/pyasteroids-0.5.3.rc2/pyasteroids/model.py   pyasteroids(Download)
import logging
from random import random
from pyagents import Schedule
from arena import Arena
from asteroid import Asteroid, MAX_DENSITY
    def add_asteroid(self):
        position = (random() * self.arena.width, random() * self.arena.height)
        mass = random() * (self.max_mass - self.min_mass) + self.min_mass
        velocity = [0, 0]
        density = MAX_DENSITY * 0.1 + random() * MAX_DENSITY * 0.9