I think randomizing by shuffling packets inplace would be faster and potentially simpler (by maybe 1 line?), but this definitely works.