Put the join chat with capacity for only 1 player.
waitingroom "MyChatTitle", 2, "SomeNPC::OnSomeoneEnteredChat",1;
OnSomeoneEnteredChat:
set .team, (!.team);
if(.team){
set $@Team1, waitingroom2bg("<mapname>",x,y,"SomeNPC2::OnLogout","SomeNPC2::OnDie");
warpwaitingpc "<team1reagrouplocation>", x,y;
}else{
set $@Team2, waitingroom2bg("<mapname>",x,y,"SomeNPC2::OnLogout","SomeNPC2::OnDie");
warpwaitingpc "<team2reagrouplocation>", x,y;
}
end;
btw, you said randomly and I didn't pay too much attention to that, sorry. The code above is not entirely random, since it will warp 1 person to each team so the teams keep the same amount of players when the event starts.