added cpp code. mv random and fact to own folder for c code