add some tests on randomly generated numbers, to ensure correctness