Hi every body,
I want to genrate random variables wich are exponentially distributed.
I can't do this.
please some help
Hi every body,
I want to genrate random variables wich are exponentially distributed.
I can't do this.
please some help
Read the section entitled "Generating exponential variates" at this link. That will give you a place to start.
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
> 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.