min random calculation.