randfloat(max){ new tmp = random(max*1000); //1000 gives back %.3f, 100 gives back %.2f and so on new result = floatdiv(float(tmp), 1000.0); return result;}