A new algorithm may make robots safer by making them more aware of human inattentiveness. In computerized simulations of packaging and assembly lines where humans and robots work together, the algorithm developed to account for human carelessness improved safety by about a maximum of 80% and efficiency by about a maximum of 38% compared to existing methods.