fixes for random numbers that I swear I had already made. fixes to sampler as incorporated from gibberish.