Wrestling scrimmaging is agreed upon before hand (ie Greco or freestyle).
In judo we agree beforehand on whether to allow leg grabs/touches (old school) or not - most of the older guys (ie 25+) still agree to use leg grabs, including one guy who started here, moved away and now competes internationally, but comes back regularly to visit his folks - his best throw as a kid was kata-guruma, and he loves being able to use it in randori. The younger guys go by current rules, and I'm afraid most of them couldn't defend against any kind of leg grab (morote gari, kata guruma etc) if their life depended upon it.
The BJJ instructor who teaches a ne-waza class for us sometimes has them use BJJ rules (including leg locks), sometimes not - I think when judo tournaments are coming up he tends to stick to judo rules, otherwise BJJ rules.
Basically, its on a person to person, agree upon the rules before hand (though of course, guys end up rolling/randori with the same people all the time, so they just assume it'll be the same rules as they usually use).