Absorbing layers are sometimes required to be impractically thick in order to offer an accurate approximation of an absorbing boundary condition for the Helmholtz equation in a heterogeneous medium. It is always possible to reduce an absorbing layer to an operator at the boundary by layer-stripping elimination of the exterior unknowns, but the linear algebra involved is costly. We propose to bypass the elimination procedure, and directly fit the surface-to-surface operator in compressed form from a few exterior Helmholtz solves with random Dirichlet data. We obtain a concise description of the absorbing boundary condition, with a complexity that grows slowly (often, logarithmically) in the frequency parameter. We then obtain a fast (nearly linear in the dimension of the matrix) algorithm for the application of the absorbing boundary condition using partitioned low rank matrices. The result, modulo a precomputation, is a fast and memory-efficient compression scheme of an absorbing boundary condition for the Helmholtz equation.