FillRandom for TProfile histogram?

Is there something analogous to the FillRandom I use for TH1F that works on 1D profile histograms (TProfile)?

I need to use a profile histogram because I would like to know the mean of the events in a bin in addition to the number of events in that bin.

My goal is basically to randomly fill a histogram according to some pdf I have defined as a TF1. However, I need to know the number of events and mean of the events in each bin. This is basically a special case of a TProfile where both x and y are the same. Thus, if there is a FillRandom for TProfile, then I will be able to accomplish this.

Does such a thing exist? If not, can anyone suggest a workaround?

Thanks in advance


there is no such a function for this special case (i.e. when x is used in both the x and y axis). However you can easly sample the numbers from a TF1 and then fill your profile:

TF1 * f1 = .....
TProfile * profile = .....
for (int i = 0; i < n; ++i) { 
  double x = f1->GetRandom(); 

Best Regards