Hi Phenix

There can be two possibilities to send a packet with 50% and 75%
probability:

1. Generate random number, either 0 or 1 randomly. If the generated number
is 0, the packet is supposed to be sent otherwise drop.
2. Generate random number between 0 and100. If the generated number is below
75, then send the packet, otherwise drop (in case of 75% Probability).

Hope it answers your question.

Regards
Mubashir Husain Rehmani
www-rp.lip6.fr/~rehmani <http://www-rp.lip6.fr/%7Erehmani>

2009/2/18 Phenix <phenix...@hhu.edu.cn>

> Hi Sidney,
>
>  Phenix,
>>
>> Is this discussion about probability technics or about how to
>> implement them in c++?
>>
>
> Both.
> I'd like to know how can I implement probability-based mechanism in c++
> more exactly.
>
>
>> Sidney Doria
>> UFCG / BRAZIL
>>
>>
>>
>> 2009/2/18 Phenix <phenix...@hhu.edu.cn>:
>>
>>>
>>> Hi Mubashir,
>>>
>>> Thanks for your advice. But I don't think this method denotes a rigorous
>>> probability-based mechanism.
>>> In fact, the packet may not be forwarded even with a probability of 90%.
>>> But using your method,
>>> it must be forwarded if only the probability exceeds a threshold.
>>>
>>> Any other ideas?
>>>
>>> Regards,
>>> Phenix
>>>
>>>
>>> From: Mubashir Rehmani
>>> Sent: Wednesday, February 18, 2009 3:49 PM
>>> To: Phenix
>>> Cc: ns-users
>>> Subject: Re: [ns] how to forward packets based on probability
>>>
>>>
>>> Hi Phenix,
>>>
>>> To forward a packet with certain probability, you need to include an if
>>> condition in the sendPkt() function. It should be something like this:
>>>
>>> If(probability > 0.5)
>>> {
>>>  Scheduler::instance().schedule(target_, p, delay);
>>> }
>>>
>>> in the SendPkt() function.
>>>
>>> Hope it helps
>>>
>>> Regards
>>> Mubashir
>>> www-rp.lip6.fr/~rehmani <http://www-rp.lip6.fr/%7Erehmani>
>>>
>>>
>>> 2009/2/18 Phenix <phenix...@hhu.edu.cn>
>>>
>>>
>>>
>>>  Hi guys,
>>>
>>>  How to implement probabilistic-based flooding in NS-2 ? Say, upon
>>> receiving a packet, a mobile node will decide whether to forward it with a
>>> certain probability.
>>>
>>>  I only know we can use the function below to send a packet in NS-2:
>>>            Scheduler::instance().schedule(target_, p, delay);
>>>  But how to deal with the probability?
>>>
>>>
>>>  Regards,
>>>  Phenix
>>>
>>>
>>>
>>>
>>>
>>> --
>>> Mubashir Husain Rehmani
>>>
>>>
>>>
>>>
>>
>>
>> --
>> Sidney Doria
>> Redes ad hoc móveis
>> Doutorado em Computação
>> UFCG
>> Brasil
>>
>> "Nessa jornada, o conhecimento será o seu escudo..."
>> (Mestre dos Magos no episódio do grimoire de ouro)
>>
>>
>


-- 
Mubashir Husain Rehmani

Reply via email to