fixed bug and enabled program to generate random function