A random split can leave a rare class missing from the test set. A stratified split keeps each class's share the same in both parts.
Implement stratified_split(y, test_size, seed=0) returning (train_idx, test_idx) as sorted integer arrays:
np.random.default_rng(seed) and put round(test_size * count) of them in the test set