That's how history works.
Ruby's actions are even more serendipitous.
It had been well publicized that Oswald was to be transferred to from the police station to the jail at 10:00 AM.
Ruby was home at that time but received a phone call at 10:19 from one of his strippers who needed $25.
So he picks up his little dog and they drive down to the Western Union station to wire the cash. The police station is across the street.
As luck (there you go) would have it, the interrogation etc. of Oswald took way too long and Ruby noticed a crowd outside the entrance.
He is curious...knows the cops....and walks right in.
Being a wannabe wiseguy (who is laughed at be the true wiseguys) he always carries a pistol.
Opportunity knocked....he answered.
No intent....just horrible opportunity.