What determines the final firing order on a normal car engine?

The way the crankshaft is built. Which controls the order that the pistons move up and down.