read from txt file, establish basic loop and random generator