A woman who shot three people before turning the gun on herself Tuesday at the California headquarters of tech company YouTube visited a local gun range before the attack, according to police.

Chaos erupted when a shooter, identified by police as 39-year-old San Diego resident Nasim Najafi Aghdam, opened fire in a courtyard on YouTube’s campus.