What I did was to read an unconnected (floating) ADC pin, keep only the
least significant bit, shift that into a uint32_t, and repeat that until
I had 32 random(ish) bits. It probably isn't cryptographically secure,
but I only needed one random number (because I was using it as a
temporary identifier while obtaining a node ID over the radio). Of
course you could use that to seed RandomC if you want to generate more
random numbers.

HTH,
Michiel

> -----Original Message-----
> From: [email protected] [mailto:tinyos-help-
> [email protected]] On Behalf Of Markus Niedermann
> Sent: maandag 13 september 2010 22:34
> To: [email protected]
> Subject: [Tinyos-help] Random Number Problem
> 
>   At first, i want to say hello.
> This is my first mail at this mailinglist.
> I'm Markus N. from Karlsruhe, Germany, Student of Computer science.
> 
> My situation:
> i have 2 micaz motes with the same software installed. (Same
> TOS_NODE_ID, too)
> Now, i want to have 2 different random numbers at the two motes.
> 
> My idea was it, to use RandomC, but I always get the same random
number,
> because all relevant factors at the 2 motes seems to be the same.
> 
> Is there another Random implementation with a better algorithm that
uses
> unique factors? are there any unique factors?
> It wouldn't matter, if the same random number appears at the same
mote,
> but at the other mote, i need another random number.
> 
> Thanks for your help.
> Markus

_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to