Random register state and bug fixing

* Work toward randomising the state of the registers
  (with a seed, of course) and using the random
  states in unit tests
* Don't let the fact the unit tests pass fool you,
  this is a bad commit. mock_rb() has functions asking
  it for memory which is uninitialised (tut tut)