[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [ns] Problem with the generation of random numbers
> It's calling other functions...
>
> (1) must give me a exponential value
>
> and (2) give me a 2 vectors of size AP, with random values, with some formulas.
>
> The main problem is by changing the order of (1) and (2),
>
> (2) : CalcDTX(A,P);
> (1) : rem_ = int(burstlen_.value() + .5);
>
> The exponential value depend on the numbers of random values generated before.
Yes of course. If you do NOT set separate random generator for different
random variables, their value will be taken from the same random number
generator, i.e., the same random number sequence. Therefore when you
switch these two random variables' places in thissequence you'll get
different results.
One way to deal with it is to use two independent random number
generators. Pls see ns manual chapter 20.
- Haobo
> Is it normal ? I was not expecting a correlation between this 2 operations.
>
> Thanks in advance,
>
> Karim.
>
> NB: The Floating Point Exception was not correlated to this probelm, I solved it.
>
> Karim El-Khazen
> Email : [email protected]
> Website : http://www.directmoving.com
> �
> -----------------------------------------------------------------
> Karim C. El-Khazen� [email protected] http://www.elkhazen.com
> MS in Electrical & Computer Engineering, Georgia Tech, Atlanta, USA
> Ericsson Radio Systems AB, S-164 80 Stockholm SWEDEN
> -----------------------------------------------------------------
>
>
> -----Original Message-----
> From: Haobo Yu [mailto:[email protected]]
> Sent: Thursday, August 24, 2000 4:06 AM
> To: Karim El-Khazen (ERA)
> Cc: [email protected]
> Subject: Re: [ns] Problem with the generation of random numbers
>
>
> It'll greatly help if you can provide some example scripts. I calculated
> 100 exponential values then 200 exponential ones, and the first 100 of the
> second run are identical to those in the first run.
>
> On Tue, 15 Aug 2000, Karim El-Khazen (ERA) wrote:
>
> > Hi everybody,
> >
> > I'm having a problem with the generation of random numbers.
> >
> > 1 ) I'm computing N random variables with " Random::uniform() " THEN an exponential random variable using " ExponentialRandomVariable ". I get coherent results which seem correct. If I run this simulation plenty of time, I always get the same values, since I'm not changing any initial values.
> > I tried after to change the number N of random uniform variables, the exponential value changed. It shouldn't, no ?
> > These parameters are not correlated at all (except in the random generator?!).
> >
> > 2) Then I tried to reverse the order of these generations. For N=100, it gives me a result. For N=50, I get a "Floating Point Exception (core dumped)" !!!
> >
> > Is there anybody who can help me solve this problem ?
> >
> > Thanks in advance, Karim.
> >
> >
> >
> > Karim El-Khazen
> > Email : [email protected]
> > Website : http://www.directmoving.com
> >
> > -----------------------------------------------------------------
> > Karim C. El-Khazen [email protected] http://www.elkhazen.com
> > MS in Electrical & Computer Engineering, Georgia Tech, Atlanta, USA
> > Ericsson Radio Systems AB, S-164 80 Stockholm SWEDEN
> > -----------------------------------------------------------------
> >
>