I am trying to do an integral via importance sampling formula. The algorithm is as follows: Code
The value for the integral should give: 0.838932960013382
Also I must use the next probability distribution to generate 1,000,000 random numbers between 0 and 1. I also use the next weight function. Finally with these numbers I must calculate this formula. But I am getting the numerical value wrong, and I am not sure about the calculation for the 1.000.000 random numbers.