Refactored some tests to use a mocked PRNG.
Fixed a nondeterministic test.
Added another test.