Add randomised fuzz tests to ensure that the results are consistent
across JVMs and across runs