I created a simple Joomla component and module. If you're new to Joomla, then you'd find the said extensions easy to read and study the codes.
JCRandomFacts component let's you add, edit and remove a fact.
JCRandomFacts module displays one fact save from the component.
Download component and module.