Thread: random variable with exponential distribution

  1. #1
    Registered User
    Join Date
    Jan 2013
    Posts
    4

    random variable with exponential distribution

    Hi every body,
    I want to genrate random variables wich are exponentially distributed.
    I can't do this.
    please some help

  2. #2
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    Read the section entitled "Generating exponential variates" at this link. That will give you a place to start.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

  3. #3
    Registered User
    Join Date
    Nov 2012
    Posts
    1,393
    Quote Originally Posted by momnia View Post
    I want to genrate random variables wich are exponentially distributed.
    This function is not build into the standard library. The idea of C is to be as small as possible and to provide most other things with library functions.

    Two libraries that have this function are:

    GSL (C library):
    GSL - GNU Scientific Library - GNU Project - Free Software Foundation (FSF)

    newran02 and newran03 (C++ library)
    Online documentation

    The second one is a C++ library. If you want to call it from C, you might also need this information:

    How to call C++ function from C? - Stack Overflow

  4. #4
    Registered User
    Join Date
    Nov 2012
    Posts
    54
    Quote Originally Posted by grumpy View Post
    Read the section entitled "Generating exponential variates" at this link. That will give you a place to start.
    Hey why u r confusing by these toughest equations...

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > I can't do this.
    > please some help
    What exactly are you complaining about?

    > Hey why u r confusing by these toughest equations...
    You misunderstand the nature of this board.
    You post code, we help you with it.

    If you just post your program spec and "I can't do it / please help me", then don't expect code to be handed to you on a plate.
    At best (which is what grumpy's post is), all you're going to get is references to further reading material to help you figure it out for yourself.

    Now, explain what you're really having trouble with.
    Like for example, you can generate random numbers, but not with the distribution, or the distribution is "off" in some way.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Exponential Distribution
    By charlest in forum C Programming
    Replies: 1
    Last Post: 11-24-2009, 09:37 PM
  2. assigning random value to a variable
    By shaple in forum C Programming
    Replies: 3
    Last Post: 07-17-2007, 10:14 AM
  3. mathematical random distribution
    By nicodemus in forum C++ Programming
    Replies: 2
    Last Post: 10-06-2002, 06:13 PM
  4. random number with lognormal distribution?
    By carrie in forum C++ Programming
    Replies: 4
    Last Post: 11-08-2001, 08:31 PM
  5. Replies: 5
    Last Post: 10-12-2001, 03:51 AM