not good enough, but pretty practice genPosX algorithm.