Unfortunately this approach does not work with my use case. At the beginning of everything I have N trees (stored in different files), and each tree holds a “different type” of event (but obviously all the trees share the same structure, with “different type” I mean intrinsic features e.g. how the event was generated). Now I need to shuffle between these “types”, that’s why I need to put all the entries in the same box at the same time and then pick a random one, so shuffling events in each single file it’s useless here. Also, each tree may have a different number of entries, so I can’t simply read sequentially from each of them and randomly fill another set of trees… I need to think about something smarter.
Absolutely, that was just a stupid copy-paste from a cppreference.com example