!!! This is a subfunction of "Random tiles". Do not run.

gettiledim r01 r02 r03 // Get given tile dimensions
mov r07 0 // Number of tiles found
mov r04 0
while r04 < 15360 // Maximum number of tiles
  gettiledim r04 r05 r06
  if r02 == r05
    if r03 == r06
      setpntb1x r07 r04 // Remember found tile
      inc r07
    endif
  endif
  inc r04
continue
rnd r04 // Assign random value
and r04 2147483647 // Only positive values
div r04 65536 // Take 15 major bits to provide random behavior
mod r04 r07 // Values in range from 0 to r07-1
getpntb1x r04 r01 // Get random tile ID