The program is starting to work. Implemented faster random number sampling method.