random function was interfering with stdlib random
fixing small bugs
testing fixes to small bugs
fixing small bugs