def reshuffle(expr, by=None, sort=None, ascending=True):
    by = by or RandomScalar()
    grouped = expr.groupby(by)
    if sort:
        grouped = grouped.sort_values(sort, ascending=ascending)
    return ReshuffledCollectionExpr(_input=grouped, _schema=expr._schema)