Refactoring and minor changes to public API
Refactoring driven by the addition of the TypeScript module release (cleaning up the public API a little in TypeScript) and a change to make the random number generator API more consistent with the console API.