[ns] How to change seed in NS2
Ilyes Gouta
ilyes.gouta at gmail.com
Wed Apr 26 23:18:32 PDT 2006
Hi,
You can modify the source code of RandomVariable/Uniform (the C++
part) in order to create a new binding that you would call to
reinitialize the seed or to call srandom(time()) to set a new seed.
Regards,
Ilyes Gouta.
On 4/26/06, Ghirmay Desta <ghirmish at yahoo.com> wrote:
>
> Hi maline nadine,
>
> I have had same problem too. I solved it this way. For
> every iteration, I seeded the defaultRNG with the
> random number generated in previous iteration. I hope
> this will help. Here is the implementation.
>
> #for generating random integer b/n min and max
> set nextseed 0.0
> proc randomNumber { min max } {
> global nextseed
> global defaultRNG
> $defaultRNG seed $nextseed
> set nRNG [new RNG]
> $nRNG next-substream
> set num_ [new RandomVariable/Uniform]
> $num_ set min_ $min
> $num_ set max_ $max
> $num_ use-rng $nRNG
> set nextseed [expr round([$num_ value])]
> return $nextseed
> }
>
>
> malin nadine <sidilala25000 at yahoo.fr> wrote:
>
> Hello every one
>
> I have used these commands to change the seed in
> ns-2:
>
> set val(seed) 0.0
>
>
> but when I run the same simulation many times, I got
> the same
> sesults.
>
>
> is there any help
>
> Thanks in advence
>
> Nadine
>
>
>
>
>
>
> ___________________________________________________________________________
>
> Faites de Yahoo! votre page d'accueil sur le web pour
> retrouver directement vos services préférés : vérifiez
> vos nouveaux mails, lancez vos recherches et suivez
> l'actualité en temps réel.
> Rendez-vous sur http://fr.yahoo.com/set
>
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
>
More information about the Ns-users
mailing list