fix how 'random' handles negative numbers