Math, C, Calculus, Numerical Analysis, Monte Carlo.
wouldn’t provide as much information as the x=[2,4] range where the integrand is high. A companion function to sample random values must match the shape of g(x) in terms of having a high sample probability between x=[2,4] and decaying outwards. So we can use, for instance, a normal distribution