YouTube shooter visited gun range before attacking strangers, police say