Add an optional check in TH1::ComputeIntegral that all the bin contents are positive. The check is then used in GetRandom,2,3.
If GetRandom is called on an histogram with negative content an error message is produced and a NaN is returned.
This fixes ROOT-5894