modify AB.java and randomAdding.py, add test to do auto test