#### Archived

This topic is now archived and is closed to further replies.

# Drawing samples from a CDF

This topic is 5304 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, I have a Cumulative Probability Density Function (CDF), F(x) (x>=0 but it doesn't matter here) from which I want to draw samples. My idea is: generate a uniform random number E between [0,1] and solve equation F(x)=E for x. The x obtained is a sample which has the correct distribution (according to the CDF). Is this correct or is my intuition wrong? Oh, and it's not homework =) -Mikko Kauppila [edited by - uutee on January 6, 2004 9:10:07 AM]

##### Share on other sites
That is precisely how you do it

##### Share on other sites
If you know the function F, then you can differentiate it to get the solution (f).

##### Share on other sites
Yes, you''re right on the mark. That''s the Inverse CDF method. There are a number of other approaches to this problem, but most of the ones I know are much slower.

Just out of curiosity, what are you using this for?

1. 1
Rutin
24
2. 2
3. 3
JoeJ
18
4. 4
5. 5

• 13
• 38
• 23
• 13
• 13
• ### Forum Statistics

• Total Topics
631714
• Total Posts
3001861
×