A random number generator needs a ‘seed’ to start the sequence of random numbers. RandomC uses TOS_NODE_ID as its seed unless you reseed it yourself. If you program your nodes with the same ID, then each will generate the same sequence every time.
On a PC, the system time is often used to seed a random number generator, since it gives you a constantly changing value. Most nodes don’t have a real time clock, so that won’t work. What I’ve done when I needed an “actually” random number (to use as a seed) was to read an unconnected ADC pin, keep only the lowest significant bit, and repeat that until you have as many bits as you need. An alternative source of randomness might be the radio (RSSI values). HTH, Michiel From: [email protected] [mailto:[email protected]] On Behalf Of Jisha Mary Jose Sent: Tuesday, July 08, 2014 06:48 To: [email protected]; [email protected] Subject: [Tinyos-help] Random number generation in tinyos-2.1.2 Hi, I want to generate random numbers in tinyos. I have used components RandomC. The syntax used is: DEBUG (1): 0:0:0.000000010 Random number 1: 33614 DEBUG (1): 0:0:0.000000010 Random number 2: 564950498 I get these values whenever i run the code. How to get "random" numbers? please help me, its urgent for me. Regards, Jisha Mary Jose ......jMj......
_______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
