Plotting Histogram

Hello,
I am trying to plot the histogram based on random number generated from a user defined function. I do not get any output nor any error. I could not figure out where I am doing mistake. I have attached my macros here.

Thank you
ex8.C (25 Bytes)


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


I guess you posted the wrong file. Your macro is empty:

void ex8(){



}

I am sorry. Here is the updated macro. I get error.ex8.C (797 Bytes)

My question: Can I define global variable at the top of macro like

double x_min = -0.5
double x_max = 10.6

Thank you

Move these two lines to before you define “myfunction”.

std::vector points;

if (points.size() < 2000){
for (int i=0;i<2000;i++){
double x = f1->GetRandom();
points.push_back(x);
}
Can you please explain what these three function does here, points.size and points.push_back ?

cplusplus.com -> std::vector

Google -> learn C++

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.