Corrected Memory Error & restricted rng to (0,1)