random weight, function to object