I found the solution to my problem though it is not this one exactly. My problem lied with the corresponding X - coordinates of the random number generated.
My steps were,
- To generate random numbers between 0 to 1 from my CDF.
- To find the corresponding location of these random numbers on X-axis from CDF.
As we know, in CDF, many data points on X axis can have the same cumulative probability like 1 or 0. So when I recall the corresponding position of 0.75 (cum. probability) on the X- axis, I get multiple numbers. And those created a problem.