[ndnSIM] Random Producer/consumer

Daniel Posch poschdaniel2 at gmail.com
Thu Oct 8 04:27:11 PDT 2015


Hello,

from my point of view this is a very bad idea.
In a simulation you should only use ns-3 based random variables.

See: https://www.nsnam.org/docs/manual/html/random-variables.html

This guarantees 100% reproducibility.

Greetings,
Daniel

On 10/08/2015 01:20 PM, Andrey Silva wrote:
> Hello,
>
> You have to seed it.
>
> Put this code at the beginning of you code.
>
> srand( time(NULL) );
> |
> |
> |Best regards!
> |
> |
>
> |
>
> 2015-10-08 7:34 GMT-03:00 Dhiab Imen <dhiabimen at gmail.com 
> <mailto:dhiabimen at gmail.com>>:
>
>     Hi ,
>
>     there is any one who can tell me how can I change my producer node
>     randomly  at every simulation.
>
>     I try to use rand():
>     NodeContainer c;// NodeContainer
>     c.Create (4);
>     int a=1+rand()%3 // to generate an integer between 1 and 4
>
>       producerHelper.Install (c.Get (a));
>
>     but when I want to display the value of a
>
>       std::cout << "a = "  << a <<"\n";
>
>     I have the same value even when I re-simulate my code.
>
>     thnx a  lot.
>
>     -- 
>     Cordialement
>     Imen Dhiab
>
>     ***************************************************************************************************
>     Ingénieur Informatique diplômé de l'Ecole Nationale d'Ingénieurs
>     de Sfax.
>     Membre de l'unité de recherche SAGE (Systèmes Avancés en
>     Génie Electrique), Ecole Nationale d'Ingénieurs de Sousse.
>     +216 53 59 19 88
>     Pages personnelles :
>     http://www.sage-eniso.org/profile-membre/fr/T/85/dhiab-imene.html
>     ***************************************************************************************************
>
>     _______________________________________________
>     ndnSIM mailing list
>     ndnSIM at lists.cs.ucla.edu <mailto:ndnSIM at lists.cs.ucla.edu>
>     http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim
>
>
>
>
> -- 
> Andrey Silva
>
> Engenheiro da Computação - Universidade Federal do Pará
> Mestrando em Engenharia Elétrica - Laboratório de Processamento de 
> Sinais - Universidade Federal do Pará .
> -
> http://laps.ufpa.br/
>
>
>       /
>       /
>
>
>
> _______________________________________________
> ndnSIM mailing list
> ndnSIM at lists.cs.ucla.edu
> http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20151008/6a7963e0/attachment.html>


More information about the ndnSIM mailing list