It does a bit shift right by 12 to encompass the Encounter Value's fraction and the dividing by 256.
The Encounter Value can range from 2 to 32 based on Enemy Aways/Lures you have equipped. Oddly enough, one master Enemy Away has the full effect, but it takes at least 2 Enemy Lures to reach the cap.
I think the Danger Counter is defined by the field you're in.
If it's any interest to you, this Rnd(0..255) is only pseudo-random. It uses a RNLUT that's in a different place.
REPointer += 1
if( REPointer == 0 )
REVariant += 13
return RELUT( REPointer ) - REVariant
If that number is less than [Danger Counter * ( Encounter Rate ) ] >> 12 then battle ensues. I could give you the RELUT values if you want, but I'm not sure how helpful they'd be.