>Does that work if i were also asked to generate it given mean. What i
>am trying to do is to generate jobs in an exponentially distributed
>fashion given the mean.
>like "The inter-arrival time of jobs is exponentially distributed with
>mean of ...".
>> >I was trying to find out the function in 'C' that would return me the
>> >exponential distribution value, given lambda as the argument. Can you
>> >please help me get to know the same.
>> Let uniform() be your favorite random number generator that returns
>> a random float/double in the range 0.0 < uniform() < 1.0.
>> Then I think -lambda*log(uniform()) will be exponentially distributed.
>> At least that is what some old code of my does.
bellenot 3289> maple
|\^/| Maple 6 (SUN SPARC SOLARIS)
._|\| |/|_. Copyright (c) 2000 by Waterloo Maple Inc.
\ MAPLE / All rights reserved. Maple is a registered trademark of
<____ ____> Waterloo Maple Inc.
| Type ? for help.
Quote:> assume(lambda>0);
> int(exp(-x/lambda),x=0..infinity);
lambda~
Quote:> int(exp(-x/lambda)/lambda,x=0..infinity);
1
Quote:> # So the density is exp(-x/lambda)/lambda -- compute the mean
> int(x*exp(-x/lambda)/lambda,x=0..infinity);
bytes used=1000248, alloc=851812, time=0.16
lambda~
Quote:> # Solve for -lambda*log(uniform())
> solve(P=int(exp(-x/lambda)/lambda,x=0..T),T);
-ln(-P + 1) lambda~
So lambda is the mean in this case.
--
http://www.math.fsu.edu/~bellenot
bellenot <At/> math.fsu.edu
+1.850.644.7189 (4053fax)