Like Tree1Likes
  • 1 Post By grumpy

random variable with exponential distribution

This is a discussion on random variable with exponential distribution within the C Programming forums, part of the General Programming Boards category; Hi every body, I want to genrate random variables wich are exponentially distributed. I can't do this. please some help...

  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,529
    Read the section entitled "Generating exponential variates" at this link. That will give you a place to start.
    Salem likes this.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy in reply to you, it is likely you deserve it. Suck it up, sunshine, and read this, this, and this before posting again.

  3. #3
    Registered User
    Join Date
    Nov 2012
    Posts
    1,218
    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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,761
    > 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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

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, 11:14 AM
  3. mathematical random distribution
    By nicodemus in forum C++ Programming
    Replies: 2
    Last Post: 10-06-2002, 07: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, 04:51 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21