According to the US Centers for Disease Control and Prevention, rattlesnakes can accurately strike at up to one-third their body length. The US Food and Drug Administration suggests that they can strike up to half their body length CDC.
So it depends on how big the snake is, and how far it has to go to reach you. Don’t be brave!