[Tinyos-help] random values

2010-04-28 Thread Roberto Pagliari
Hi All, I tried this code value = call Random.rand16(); if( (value 1) == 1 ) { call BitVector.set(0); call Leds.led0On(); } several times but, apparently, random always returns the same value. I wired RandomC.Init to main. Do I need to do anything else? Thanks --

Re: [Tinyos-help] random values

2010-04-28 Thread Arik Sapojnik
Never worked with it, but usually you need to initialize a seed. If you want different values - every time a different one. Arik On Thu, Apr 29, 2010 at 04:24, Roberto Pagliari robertodemed...@gmail.comwrote: Hi All, I tried this code value = call Random.rand16(); if( (value 1)

[Tinyos-help] random values

2009-11-19 Thread wafa jaballah
Hi all, I want to generate a random value in each simulation. So I do like this: rnd=call Random.rand16(); When I simulate in TOSSIM using tinyos2.x, I have the same value of rnd in each simulation. How can I do to have a different random values. Thanks -- Wafa Ben Jaballah

Re: [Tinyos-help] random values

2009-11-19 Thread Paul Johnson
Wafa, You'd have to check the NESDOC for the particular component you are wiring to Random, but I am pretty sure there is a call that allows you to set the seed of the random number generator. There may also be a way to do this within the python program. -Paul wafa jaballah wrote: Hi all,