hemm.

is there anyway you can step into the code?   via a debugger to see what it
is doing?

you could also take a look at the generated app.c to see what
SeedInit__init is doing


On Thu, Jul 10, 2014 at 2:18 AM, Jisha Mary Jose <jishamary1...@gmail.com>
wrote:

> I did that, i changed the seed. But still same numbers are generated again
> and again at a particular node.
>
> Regards,
>
> Jisha Mary Jose
> ......jMj......
>
>
> On 10 July 2014 13:05, Eric Decker <cire...@gmail.com> wrote:
>
>>
>> asked and answered.
>>
>> The random number generator is pseudo-random.
>>
>> It starts up using a SEED which you need to modify to get different
>> sequences.
>>
>>
>>
>> On Wed, Jul 9, 2014 at 11:52 PM, Jisha Mary Jose <jishamary1...@gmail.com
>> > wrote:
>>
>>>  Hi,
>>>
>>> I have to generate random number for a node to use in key generation.
>>> But i always get the same random number. So ichanged seed value using the
>>> current system time as shown below.
>>>
>>> module SecurityC{
>>>
>>>     uses interface Boot;
>>>     uses interface Random;
>>>     uses interface ParameterInit<uint16_t> as SeedInit;
>>>     uses interface Timer<TMilli>;
>>> }
>>>
>>> implementation{
>>>
>>>     uint32_t rand1;
>>>     uint32_t t;
>>>
>>>     event void Timer.fired() {
>>>
>>>          t=call Timer.getNow();
>>>         dbg("Boot", "%s Current time: %d \n", sim_time_string(), t);
>>>     }
>>>
>>>     event void Boot.booted()
>>>     {
>>>
>>>         dbg("Boot", "Application booted.\n");
>>>         t=call Timer.getNow();
>>>         call SeedInit.init(t);
>>>
>>>         rand1 = (call Random.rand32()%10)+7;
>>>
>>>         dbg("Boot", "%s Random number 1: %d \n", sim_time_string(),
>>> rand1);
>>>
>>>     }
>>> }
>>>
>>> But still i am getting the same number always. How to solve this?
>>> Regards,
>>>
>>> Jisha Mary Jose
>>> ......jMj......
>>>
>>> _______________________________________________
>>> Tinyos-help mailing list
>>> Tinyos-help@millennium.berkeley.edu
>>> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>>>
>>
>>
>>
>> --
>> Eric B. Decker
>> Senior (over 50 :-) Researcher
>>
>>
>


-- 
Eric B. Decker
Senior (over 50 :-) Researcher
_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to