moved some definitions from the main.c file
implemented the generation of multiple sets of random references