TTree random access

In Shuffling TTrees (together) I have suggested to do it in 2 steps:
a) split randomly into many “small-enough” trees (20 was my suggestion, but you could probably use 40 - that would give you 40 trees with 250 MB each)
b) shuffle these trees individually, using LoadBaskets

At the end, join the trees or add them to your TChain.

I think that should work :slight_smile:

By the way: why are you using a std::list here?! Just put the indices in the std::vector. Also, GetEntries returns a Long64_t, so you might want a std::vector<Long64_t> v and ranges::iota(v, 0ll) instead of int.