A linear response Monte Carlo algorithm for inversion layers and magnetotransport