The different modes allow you to pick or random a hero and then pick or random 4 skills for the hero. d2ware just recently introduced the deathmatch mode which basically randoms a hero for you, once you die, you respawn with another randomed hero with same items/lvl.
On the Custom Realms client, you're the one being used as host and takes a bit longer to set up, but on d2ware there are actually servers that host automatically once 10 ppl join a lobby which is rly neat.
Have fun.
How legal is this?
If you're looking for a reliable answer, I suggest you pose this question on the dev forums and get a response from the devs themselves.
I never heard of anyone getting banned for this or anything like it since it rly doesn't affect the actual game/matchmaking in any meaningful way + other source engine based game have plenty of mods out already, I believe that this mentality is actually encouraged by Valve.