The energy associated with the random motion of molecules or atoms within a substance is A. electromagnetic energy. B. thermal energy. C. gravitational potential energy. D. chemical energy.