[ndnSIM] Random Producer/consumer

Andrey Silva andreysilva.eng at gmail.com
Thu Oct 8 04:20:42 PDT 2015


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>:

> 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
> 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/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20151008/5106aade/attachment.html>


More information about the ndnSIM mailing list