Lets say you have a bunch of points and you want to create a variable number of groups for them. First, use a Sort SOP to randomize the point order, then a ForEach SOP with the For set to Each Number, inside of which you place a group node after the sort1 that is there by default.
In the group field write the expression
"group"+stamp("..", "FORVALUE", 0)
Set the Entity to Points and Operation to Group By Expression. Then set the expression to
!($PT+stamp("..", "FORVALUE", 0)) % ch("../numrange2")