changes in ballistic term & checking for p before getting random value