Hi,
I am trying to use the STL random_shuffle() function within CINT. I keep getting this error:
Processing shuffle_test.cpp…
Error: Function distance_type(first) is not defined in current scope algo.h(537
)
*** Interpreter error recovered ***
This code works fine outside of ROOT e.g. in VisualC++.
Here is the code:
#include
#include
#include
using namespace std;
vector vi;
int shuffle_test(void)
{
for (int i = 0; i < 100; i++)
{
vi.push_back(i);
}
random_shuffle(vi.begin(), vi.end());// shuffle elements
for (int i = 0; i < 100; i++)
{
cout<<vi[i]<<endl;
}
return 0;
}