Thanks to Alf, I have discovered the WordPress [sourcecode] tag. Where I would previously use <code> and <pre> and get the following result:
int true_random() { return 4; //Generated by fair roll of a die }
I now use [sourcecode language="cpp"] ... [/sourcecode] and get the following:
int true_random() { return 4; //Generated by fair roll of a die }
The syntax highlighting and line numbering is done client-side with JavaScript, but even without JavaScript the code looks nicely formatted with <pre>.
I have gone through all my older posts and updated them to use the new tag, please let me know if you see any spots I missed, or any errors I made in the process.